Sample libcurl code from internet compiles but doesn't seem to do anything?

I finally got this sample piece of code that uses libcurl to compile but it doesn't seem to do anything once it compiles..? It apparently is supposed to log in to the site specified with the credentials you list below and then output to the console but it doesn't seem to be outputting anything to the console? What is supposed to happen? I want this to be done on google chrome

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>


int main()
{

curl_global_init( CURL_GLOBAL_ALL );
CURL * myHandle = curl_easy_init ( );

// Set up a couple initial paramaters that we will not need to mofiy later.
curl_easy_setopt(myHandle, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_easy_setopt(myHandle, CURLOPT_AUTOREFERER, 1 );
curl_easy_setopt(myHandle, CURLOPT_FOLLOWLOCATION, 1 );
curl_easy_setopt(myHandle, CURLOPT_COOKIEFILE, "");

// Visit the login page once to obtain a PHPSESSID cookie
curl_easy_setopt(myHandle, CURLOPT_URL, "http://www.cplusplus.com/user/access.cgi?w=login");
curl_easy_perform( myHandle );


// Now, can actually login. First we forge the HTTP referer field, or HTS will deny the login
curl_easy_setopt(myHandle, CURLOPT_REFERER, "http://www.cplusplus.com/user/access.cgi?w=login");
// Next we tell LibCurl what HTTP POST data to submit
char *data="User name=agle&Password=cat2001";
curl_easy_setopt(myHandle, CURLOPT_POSTFIELDS, data);
curl_easy_perform( myHandle );

curl_easy_cleanup( myHandle );


return 0;
}
I want it to log in to a specific site with the credentials i hard code in. The site I am going to apply this to only can be accessed on google chrome.
Topic archived. No new replies allowed.