已知一个PHP网页的地址,如何将其页面内容读出来? 已知一个PHP网页的地址,如何将其页面显示的内容读出来?并不是要显示出来,而是将读出来的数据放到数组或者边量里大家给段代码吧……谢谢大家 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 HINTERNET hSession; HINTERNET hConnection; HINTERNET hRequest;hSession = InternetOpen("test", 0, NULL, NULL, 0); hConnection = InternetConnect(hSession, g_strVnetIP.c_str(), g_iVnetPort, NULL,NULL,INTERNET_SERVICE_HTTP, 0, 1); string tempstr = "ReqType=a&BindCommId=b"; string strFind = g_strVnetUrl; strFind += tempstr; hRequest = HttpOpenRequest(hConnection, "POST", strFind.c_str(), "HTTP/1.0", NULL, NULL, INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE, 1); string strHeaders = "Accept:*/*\r\n""Content-Type:application/x-www-form-urlencoded\r\n"; BOOL bRet = HttpSendRequest(hRequest, strHeaders.c_str(), lstrlen(strHeaders.c_str()), NULL, 0); if (!bRet) { g_pAppLogger->OutputAppLog("GetVnetBill -HttpSendRequest failed:%d",bRet); InternetCloseHandle(hRequest); InternetCloseHandle(hConnection); InternetCloseHandle(hSession); return -1; } string strRecv; char szBuffer[1024]; DWORD dwRead = 0; while (InternetReadFile(hRequest, szBuffer, sizeof(szBuffer), &dwRead)) { if(dwRead != 0) strRecv.append(szBuffer, dwRead); else break; } InternetCloseHandle(hRequest); InternetCloseHandle(hConnection); InternetCloseHandle(hSession);读出来的字符串在strRecv里 结构体中只能包含结构体指针么? chtmlview问题 魔兽难道用的不是DirectX? 问一个关于CString中的中文字符的问题 这种情况应如何处理 线程中使用CAsyncSocket的派生类的问题 内存位图的问题? 用vc混口饭吃,应至少掌握哪几方面的内容? 怎样把BYTE型转成VARIANT型 我在使用ADO中分别用到了存储过程的输入、输出参数,但在参数数据类型的转换上出了问题,请指教。 已知一个PHP网页的地址,如何将其页面内容读出来? 提问两个不是很难的问题:如何销毁整个程序?
HINTERNET hConnection;
HINTERNET hRequest;hSession = InternetOpen("test", 0, NULL, NULL, 0);
hConnection = InternetConnect(hSession, g_strVnetIP.c_str(), g_iVnetPort,
NULL,NULL,INTERNET_SERVICE_HTTP, 0, 1);
string tempstr = "ReqType=a&BindCommId=b";
string strFind = g_strVnetUrl;
strFind += tempstr;
hRequest = HttpOpenRequest(hConnection, "POST", strFind.c_str(), "HTTP/1.0", NULL,
NULL, INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE, 1);
string strHeaders = "Accept:*/*\r\n""Content-Type:application/x-www-form-urlencoded\r\n";
BOOL bRet = HttpSendRequest(hRequest, strHeaders.c_str(), lstrlen(strHeaders.c_str()), NULL, 0);
if (!bRet)
{
g_pAppLogger->OutputAppLog("GetVnetBill -HttpSendRequest failed:%d",bRet);
InternetCloseHandle(hRequest);
InternetCloseHandle(hConnection);
InternetCloseHandle(hSession);
return -1;
}
string strRecv;
char szBuffer[1024];
DWORD dwRead = 0;
while (InternetReadFile(hRequest, szBuffer, sizeof(szBuffer), &dwRead))
{
if(dwRead != 0)
strRecv.append(szBuffer, dwRead);
else
break;
} InternetCloseHandle(hRequest);
InternetCloseHandle(hConnection);
InternetCloseHandle(hSession);读出来的字符串在strRecv里