cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP GET Request Message

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 10 Apr 2004 14:16:59 +0200 (CEST)

On Fri, 9 Apr 2004, Monica Lau wrote:

> I believe the "Host" field is filled out by the "CURLOPT_URL" option using
> the curl_easy_setopt function. My question is in regards to the "GET" field
> in the HTTP request message -- how do I fill this in libcurl?

That too is taken from the URL you pass to libcurl. The path sent in the
request is basicly what's right of the host name in the URL.

> I want to fill it with the XML string, rather than with an html page.
> (I've looked at the documents and sample code, but most of them are for
> posting data.

Normally you provide data (using GET) to servers by doing
"http://host.com/path?data=<whatever>". Then the "path/?data=<whatever>" part
is sent in the actual GET line to the server.

> Also, how can I specify a port number (other than 80) using libcurl?

You can specify it within the URL like with browsers etc, so for asking for
port 1234 you write it:

        http://host.com:1234/path/to/file

CURLOPT_PORT can also be used to override whatever port number the URL
implies.

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-10