Dear Sir,
Plz help me.
Q. how to connetion via Proxy to HTTP server.Any athuntication is reqired.
Q.I write some code to send the data to Server but it will give error that server did not allow the request.At this time if i donot use proxy data will be send sucessfull but at the time when i use proxy the error will occure.
Q.How to Upload the File on HTTP server using Winint.CInternetsession + CInternetconnetion.
Q.Is posible to upload the file directly on server using ChttpConnection.Or any server side code will requre to upload the file.
shrikant guravPosted Jan 10, 2008, 1:10 AM
Plz reply..
Thanks
How to make Proxy authentication in MFC. I use InternetSetOption method for it.But still i get ERROR_INTERNET_CONNOT_CONNECT.
in this i does not want to prompt the dialog box to take username and pwd , i do it hardcode,But i dosenot want to do this bcz every client have diff user name and pwd.What is possibility to tackle this.
Is any example for
Thanks..
shrikant guravPosted Jan 9, 2008, 12:56 AM
NULL,
NULL, INTERNET_FLAG_SECURE);
hConnectHandle = InternetConnect(hOpenHandle,
"www.pxlsoft.com",
INTERNET_INVALID_PORT_NUMBER,
//INTERNET_DEFAULT_HTTPS_PORT,
_T("LoginName"),
_T("PWD"),
INTERNET_SERVICE_HTTP,
0,0);
hResourceHandle = HttpOpenRequest(hConnectHandle, "POST",
"URL TO PHP",
NULL, NULL, NULL,
INTERNET_FLAG_KEEP_CONNECTION,
0);
resend:
CString h = _T("Content-Type: multipart/form-data");
CString s = _T("File_Content=hi &filename=hello.xml");
BOOL bo = HttpSendRequest(hResourceHandle,(LPCTSTR)&h, h.GetLength(),(LPVOID)&s ,s.GetLength());
// dwErrorCode stores the error code associated with the call to
// HttpSendRequest.
dwErrorCode = hResourceHandle ? ERROR_SUCCESS : GetLastError();
dwError = InternetErrorDlg(this->GetSafeHwnd(), hResourceHandle, dwErrorCode,
FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
NULL);
if
(dwError == ERROR_INTERNET_FORCE_RETRY)goto resend;
DWORD dwNumberOfBytesRead;char sz[1024];
string strResult;
int result;
do {
result = InternetReadFile(hResourceHandle, sz, 1023, &dwNumberOfBytesRead);
sz[dwNumberOfBytesRead] = '\0';
int x = strlen(sz);
strResult += sz;
memset(sz, 0, 1024);
} while(result && dwNumberOfBytesRead != 0);
Q. this is the code which i am using for authentication but i m unable to POST data , GET will work.
Q.Why INTERNET_INVALID_PORT_NUMBER used in InternetConnection , i use 443 but it not working , Dailog box for asking Username and PWD will not be pop up if i use 443.
Q.Authentication is become Heaktic for me.
Blocked AccountPosted Jan 9, 2008, 12:20 AM
http://www.informit.com/library/content.aspx?b=Visual_C_PlusPlus&seqNum=111&rl=1
Hope,It will help you.
Happy Coding!!