mark一下!
#include <windows.h>
#include <WinInet.h>
#include <string>
using namespace std;
#pragma comment(lib,"wininet.lib")
char* GetUrl2(const char* strName,char* strObject)
{
HINTERNET hSession = ::InternetOpen("MSDN SurfBear",
PRE_CONFIG_INTERNET_ACCESS,
NULL,
INTERNET_INVALID_PORT_NUMBER,
0) ;
// Connect to www.microsoft.com.
HINTERNET hConnect = ::InternetConnect(hSession,
strName,
INTERNET_INVALID_PORT_NUMBER,
"",
"",
INTERNET_SERVICE_HTTP,
0,
0) ;
// Request the file /MSDN/MSDNINFO/ from the server.
HINTERNET hHttpFile = ::HttpOpenRequest(hConnect,
"GET",
strObject,
HTTP_VERSION,
NULL,
0,
INTERNET_FLAG_DONT_CACHE,
1);
// Send the request.
BOOL bSendRequest = ::HttpSendRequest(hHttpFile, NULL, 0, 0, 0);
// Get the length of the file.
char bufQuery[32] ;
DWORD dwLengthBufQuery = sizeof(bufQuery);
BOOL bQuery = ::HttpQueryInfo(hHttpFile, HTTP_QU

这篇博客记录了如何利用WinAPI函数进行HTTP GET请求的实现,以获取www.hao123.com上的/task.asp?uid=123页面的内容。
最低0.47元/天 解锁文章
5008

被折叠的 条评论
为什么被折叠?



