سلام
نمیخواستم تایپیک جدید الکی ایجاد کنم
و چون کدشم مربوط به این تایپیک بود همینجا میگم.
یک مشکلی در curl دارم
کد :
#include <urlmon.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <wininet.h>
#include <iomanip>
#include <windows.h>
#include <fstream>
#include <sstream>
#include <curl/curl.h>
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
#include <curl/easy.h>
#include <WinInet.h>
#pragma comment(lib, "wininet.lib")
using namespace std;
int main()
{
string OpenURL(std::string);
cout << OpenURL("http://www.google.com/");
getchar();
return 0;
}
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;
}
کد رو از لینک:
https://barnamenevis.org/showthread.p...light=curl+cpp
کمک گرفتم.
ff.png