cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HELP: how can i do POST with setting URL to " / "

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Thu, 29 Jul 2010 12:16:45 -0400

2010/7/29 <xiusandake_at_yahoo.co.jp>

> dear all:
>
> thank you for reading this mail~
>
> i need to create a http client for sending a http request to a http server
> as following format:
>
> POST / HTTP/1.1
> HOST: 192.168.1.2
> Accept: ... ...
> Content-type: ... ...
> ... ...
>
> so i write a source code like this:
>
> easy_set_opt(curl, URL, " / ");
> curl_slist_append(slist, "HOST: 192.168.1.2");
> ... ...
> curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
> curl_easy_perform(curl);
> when i run this program, i got a error message like this:
>
> fail to resolve URL "/"
>
> if someone know something about this
> please give me a help!
>

The url is supposed to be the whole url:

     curl_easy_setopt (curl, CURLOPT_URL, "http://192.168.1.2/");

The man page says if you leave off the protocol part (http://, or ftp://,
etc) it will try to guess based on the hostname. You're not even giving a
hostname or ip address.

Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-29