cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Header manipulation.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 25 Jan 2001 14:06:37 +0100 (MET)

On Thu, 25 Jan 2001, Jose Landivar wrote:

> I am trying to get the XML-RPC spec implementation (www.xmlrpc.com) in
> PHP to support HTTPS through the curl functions available. PHP has
> support for the init, exec, etc. etc.. curl functions.

Yes, so I've been told. ;-)

> *******************************************************
> Header requirements
>
> The format of the URI in the first line of the header is not specified.
> For example, it could be empty, a single slash, if the server is only
> handling XML-RPC calls. However, if the server is handling a mix of
> incoming HTTP requests, we allow the URI to help route the request to the
> code that handles XML-RPC requests. (In the example, the URI is /RPC2,
> telling the server to route the request to the "RPC2" responder.)
>
> A User-Agent and Host must be specified.
>
> The Content-Type is text/xml.
>
> The Content-Length must be specified and must be correct.
> *******************************************************
>
> Basically, User-Agent and Host must be specified. This could be dealt
> with the 'CURLOPT_USERAGENT' and 'CURLOPT_REFERER' (I think).

No. CURLOPT_USERAGENT sets user-agent all right, but Host: is automatically
set correctly if you don't tamper with it yourself. CURLOPT_REFERER is for
the referer field.

> Furthermore, the Content-Type must be text/xml and I do not know how to
> achieve this with the current options?.

I really don't know how they offer this interface to PHP, but the standard
libcurl has a CURLOPT_HTTPHEADER option that allows you to set a list of
custom headers to include in the HTTP request. One of them could very well be
"Content-Type: text/xml".

> Also, the Content-Length must be specified. Can I use the
> 'CURLOPT_INFILESIZE' option?.

Just another header to set with CURLOPT_HTTPHEADER. Although a normal post
operation using libcurl sets the Content-Length properly itself (.. which
you override if you set the header yourself).

> Any help would be helpful, I'd really appreciate it!,

Just remember that libcurl is a general file transfer library and you're
using the PHP-glue for it. I'm not fluent in PHP, I have not written the PHP
layer and I don't know much about it (even though I now have that book Hughes
Sterling wrote that includes curl-examples). So please have patience with me.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-01-25