在編譯庫之前,我已經開始使用cURL庫。我發送請求,並有一些問題。我使用cURL工作的代碼:cURL請求已更改
CURL *curl=NULL;
CURLcode res;
struct curl_slist *headers=NULL; // init to NULL is important
curl_slist_append(headers, "POST /oauth/authorize HTTP/1.1");
curl_slist_append(headers, "Host: sp-money.yandex.ru");
curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
curl_slist_append(headers, "charset: UTF-8");
curl_slist_append(headers, "Content-Length: 12345");
curl = curl_easy_init();
if(!curl)
return 0;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, "sp-money.yandex.ru");
curl_easy_setopt(curl, CURLOPT_PROXY, "127.0.0.1:8888");
if(curl_easy_perform(curl)!=CURLE_OK)
return 1;
我已經使用proxy,fiddler2來檢查發送到服務器的數據。當我檢查發送的數據 我得到的結果:
POST HTTP://sp-money.yandex.ru/ HTTP/1.1
Host: sp-money.yandex.ru
Accept: */*
Connection: Keep-Alive
Content-Length: 151
Content-Type: application/x-www-form-urlencoded
也是我使用Wiresharck,導致相同的檢查這個數據。
你知道爲什麼在第一線捲曲寫道:
POST HTTP://sp-money.yandex.ru/ HTTP/1.1
我送
POST /oauth/authorize HTTP/1.1
我使用VS 2010的工作,也是我不使用框架
+1我的發現也很遺憾沒有經歷過捲曲 – sehe
我不是一個libcurl大師,不會說我有經驗,但是我碰巧用它了一下:) –