Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: Banana fanna fo fanna on June 12, 2007, 09:25 AM

Title: Win32 API and HTTP
Post by: Banana fanna fo fanna on June 12, 2007, 09:25 AM
Easy way to request a URL and get the HTTP response with the native Win32/POSIX API? Something like:


HTTPResponse response;
char buffer[255];
FetchURL("http://www.blah.com/dosomething.php?x=y", &response, &buffer, 255);
printf("Response body was of length %d and was: %s\n", response.content_length, buffer);
Title: Re: Win32 API and HTTP
Post by: Skywing on June 12, 2007, 09:56 AM
WinHttp: WinHttpOpen, WinHttpOpenRequest, WinHttpSendRequest, WinHttpReadData.

Or, alternatively (though WinHttp is considered the preferred choice on modern platforms), there still exists WinInet: InternetOpen, InternetOpenUrl, InternetReadFile (or the Http* APIs instead, or InternetDownloadUrlToFile).
Title: Re: Win32 API and HTTP
Post by: Banana fanna fo fanna on June 13, 2007, 07:16 AM
Merci.