Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(void)
- {
- CURL *curl;
- CURLcode result;
- FILE *fd;
- if(NULL == (fd = fopen("annonce.html","w"))) { return -1; }
- curl_global_init(CURL_GLOBAL_ALL);
- curl = curl_easy_init();
- if(curl) {
- curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0");
- curl_easy_setopt(curl,CURLOPT_AUTOREFERER,1);
- // curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1);
- curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
- curl_easy_setopt(curl,CURLOPT_URL, "http://www.alsacreations.com/ident/register/");
- curl_easy_perform(curl);
- curl_easy_setopt(curl,CURLOPT_POST, 1);
- curl_easy_setopt(curl,CURLOPT_REFERER,"http://www.alsacreations.com/ident/register/");
- char *data="name=Gerard&email=captainchrisprod@free.fr&qcap=chaud";
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- curl_easy_setopt(curl,CURLOPT_WRITEDATA,fd);
- result = curl_easy_perform(curl);
- /* Vérification si erreur */
- printf("CurlCode: %d", result);
- if( result != CURLE_OK)
- fprintf(stderr,"curl_easy_perform() failled : %s\n", curl_easy_strerror(result));
- /* Nettoyage */
- curl_easy_cleanup(curl);
- }
- curl_global_cleanup();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement