On 12/15/2009 04:42 AM, [email protected] wrote:
sending the mail again as some junk got introduced in the sample code
below.
Regards.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Tuesday, December 15, 2009 10:01 AM
To: [email protected]
Subject: CURLOPT_URL returning FALSE
Hi,
I am just trying to send some POST data to a windows server.
But, CURLOPT_URL, which is the very first line in my code, which sets
the URL to the server to which I am sending POST data, returns false.
Please find the code sample below:
#include<stdio.h>
#include<curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init ();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL ,
"http://10.31.251.161:5985/wsman"); // this call returns FALSE
?????????????
curl_easy_cleanup(curl);
}
return 0;
}
Am I missing something? Please suggest.
I dont see the post fields you want to send??
Your code should look like this
#include<stdio.h>
#include<curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init ();
if(curl) {
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"user=isaac&pas=3434");
curl_easy_setopt(curl,CURLOPT_URL,"http://10.31.251.161:5985/wsman");
curl_easy_perform(curl);//send to URL
}
return 0;
}
NB://set the postfields and send.
Ensure that the web app is set to receive post and not get and confirm
it works correctly.
Check logs for data posted by curl.
All the best.
BR,
Isaac
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html