تو ويندوز ميتونيد از توابع API کتاب خونه WinInet استفاده کنيد
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <Windows.h>
#include <WinInet.h>
#pragma comment(lib, "wininet.lib")
using namespace std;
string OpenURL(const char *Url)
{
string strOut;
HINTERNET hSession = NULL;
HINTERNET hFile = NULL;
DWORD dwBytesRead = 0;
hSession = InternetOpenA("Mozilla/5.0", 1, NULL, NULL, 0);
if(!hSession)
{
return "";
}
hFile = InternetOpenUrlA(hSession, Url, NULL, NULL, INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE, NULL);
if(!hFile)
{
//can't connect to host Url
InternetCloseHandle(hSession);
return "";
}
do {
char buffer[4000];
InternetReadFile(hFile, (LPVOID)buffer, sizeof(buffer), &dwBytesRead);
strOut.append(buffer, dwBytesRead);
} while (dwBytesRead);
InternetCloseHandle(hFile);
InternetCloseHandle(hSession);
return strOut;
}
void main()
{
string source = OpenURL("http://mysite.com/fun.php?username=admin&password=12345");
system("pause");
}