cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: RE: what does curl post

From: fancy_2626 <fancy_2626_at_163.com>
Date: Fri, 26 Oct 2012 18:24:23 -0700

Hello! I still need help to make my post work.
I used CURLOPT_DEBUGFUNCTION to trace what curl post to the URL. I find after the postfields I defined, there is a strange sequence. No matter how I tweak my postfields, it is always there. I check the length of my postfields, it looks good. Any suggestion for me? Thank you so much!
Below is the information from CURLINFO_HEADER_OUT and my code.
POST /pubs/mir07/mir07_dyn_data.html HTTP/1.1
Host: genie.weizmann.ac.il
Accept: */*
Content-Length: 38
Content-Type: application/x-www-form-urlencoded

microRNAs=hsa-miR-9&Genes=NM_001004317ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍýýýý««««««««îþ


int main(void) {
int len;
CURL *curl;
CURLcode res;
static char *postthis="microRNAs=hsa-miR-9&Genes=NM_001004317";
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
/* get verbose debug output please */
curl_easy_setopt(curl, CURLOPT_VERBOSE,1L);
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
/* First set the URL that is about to receive our POST. */
curl_easy_setopt(curl, CURLOPT_URL, "http://genie.weizmann.ac.il/pubs/mir07/mir07_dyn_data.html");
/* Now specify we want to POST data */
curl_easy_setopt(curl, CURLOPT_POST, 1L);
/* send all data to this function */
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);
len = strlen(postthis);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, len);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}



发件人:Yehezkel Horowitz
发送时间:2012-10-22 01:04
主题:RE: what does curl post
收件人:"libcurl development"<curl-library_at_cool.haxx.se>
抄送:

> I wonder how I can know if curl convey the form content to the web site and what it posts.
> …My script failed to post. Any suggestion is welcome. Thanks.

The very first step you can do is to use the CURLOPT_DEBUGFUNCTION to see the whole transaction.

Yehezkel Horowitz

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-10-27