-
July 28th, 2009, 05:51 PM
#1
Why I'm getting this error? "The URL is invalid"
Hi everybody!
I'm getting error "The URL is invalid" using the following code:
Code:
CString strHeaders =L"Content-Type: application/x-www-form-urlencoded";
CString strFormData = _T("query=murod&a=14");
CInternetSession* pSes=new CInternetSession();
CHttpConnection* pConnection =
pSes->GetHttpConnection(_T("http://www.wutever.com/"));
CHttpFile* pFile =
pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST,
_T("/news/"));
BOOL result = pFile->SendRequest(strHeaders,
(LPVOID)(LPCTSTR)strFormData, strFormData.GetLength());
Basicly, I'm trying to submit a web form with method=post. But I'm getting that error.
Why? What I'm doing wrong?
Last edited by msn92; July 28th, 2009 at 06:01 PM.
-
July 29th, 2009, 04:05 AM
#2
Re: Why I'm getting this error? "The URL is invalid"
LOL I found my mistake
Code:
CHttpConnection* pConnection =
pSes->GetHttpConnection(_T("http://www.wutever.com/"));
Looks like I should not include "http://" in the url.
Now another problem:
I'm able to send the request, but how do I get the response? The response will be a web page source?
After sending the request I wrote the content of the pFile(CHttpFile class) to a file and based on that file I'm guessing either I didn't send the request, or either I didn't get the response.
What should I do to get the response?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|