
26.02.2010, 22:54
|
|
Новичок
Регистрация: 20.09.2008
Сообщений: 29
Провел на форуме: 528520
Репутация:
13
|
|
Код:
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &body);
curl_easy_setopt(curl, CURLOPT_URL, "http://url");
curl_easy_setopt(curl, CURLOPT_HEADER,1);
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "запрос");
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, &cookies);
curl_easy_perform(curl); // посылаем
Код:
static int writer(char *data, size_t size, size_t nmemb, string *buffer)
{
int result = 0;
if (buffer != NULL)
{
buffer->append(data, size * nmemb);
result = size * nmemb;
}
return result;
}
Врайтер.
передавай ее как ссылку.
&cookie
|
|
|