I am looking for some tips how to read strings from a remote server over HTTP and save it into a string. Currently, I aim towards reading the first character.
@edit: what I have already done:
I thought that curl might be the right tool to achieve that.
compilation:
1>------ Rebuild All started: Project: cURL, Configuration: Debug Win32 ------
1> stdafx.cpp
1> cURL.cpp
1> cURL.vcxproj -> C:\Users\Lukasz\Documents\Visual Studio 2010\Projects\cURL\Debug\cURL.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
but after debug:
The procedure entry point sasl_errdetail could not be located in the dynamic link library libsasl.dll
my main file.cpp:
// cURL.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <curl.h>
#include <cstdio>
#include <string>
std::string buffer;
size_t curl_write( void *ptr, size_t size, size_t nmemb, void *stream)
{
buffer.append((char*)ptr, size*nmemb);
return size*nmemb;
}
int main(int argc, char **argv)
{
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
fwrite( buffer.c_str(), buffer.length(), sizeof(char), stdout);
return 0;
}