Hello,
I am using the following code to post data to a server using the
catlhttpclient classes:
BYTE* PostData;
CString postdata;
postdata += _T("admin_password=&login_mode=user&user_name=");
PostData = new BYTE[postdata.GetLength()+1];
memcpy( PostData, postdata, postdata.GetLength() + 1 );
PostData[postdata.GetLength() + 1] = 0;
navData.SetPostData(PostData,postdata.GetLength()+1,_T("application/octet-stream"));
navData.SetMethod(_T("POST"));
if (client->Navigate( m_urlStr, &navData ))
{
......
}
The navigate call to the server fails with a 404. When a look at the http
stream, I do not see the posted data stream
POST /login.cgi? HTTP/1.1
Content-Length: 49
Content-Type: application/octet-stream
Referer: http://10.0.5.28
Host: 10.0.5.28
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10)
Gecko/20070216 Firefox/1.5.0.10
<<the postdata variable string should be here and I do not see it???>>>
I even converted the raw bytes in the "PostData" variable to UTF8 encoding
and then tried posting but I got no results.
What am doing wrong?