cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: asynchronous posting to a webpage with cURL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 27 Aug 2007 10:54:36 +0200 (CEST)

On Sun, 26 Aug 2007, Znigniew Widomski wrote:

> I've analyzed all this with wireshark. With each post request the server
> returns the HTTP/XML protocol, and sends back some xml that the clientside
> ajax then interprets. It is vital that I be able to catch and read this xml
> that the server sends back to the client. With wireshark, I can easily read
> it. I don't know if this is what you meant before, but reading this XML with
> curl is something I definitely want to do. Is it possible to return this xml
> data with curl?

Just about *anything* that is on top of HTTP can be done with libcurl, since
you have the ability to control it to the bits if you want to. So yes, I can't
see how XML over HTTP is any trouble for libcurl.

> All I know is that it is not an HTTP protocol but the http/xml protocol
> according to wireshark. Is the xml data part of the header?

Possibly they use some headers to provide additional info. Like SOAP etc does.
libcurl supports that fine.

Of course you can browse the use request and response headers to see that.

> But it is returned via the http/xml protocol and curl I think only returns
> the http protocol.

http/xml must be wireshark's name for it. I don't think that is an accurate
description for the actual transport protocol.

> Anyways, if not possible with curl maybe there is some other http access
> library you'd recommend to use with php? (soap, pecl)

soap is a protocol on top of http, pecl is a php extension library and if you
consider pecl_http, that is http (in turn optionally powered by libcurl...)!

> Also 1 final question. On the 10th post, the server returns back xml data as
> normal. The client side ajax then interprets this xml data and runs a
> special javascript function which causes the page to automatically POST
> again on its own to another url and then be redirected. I know that curl can
> follow redirects, but what is happening is that another post is being posted
> and then thus redirected. so it would be curl posting, curl posting, with
> the second as part of default behavior of the remote site. Is that possible
> with cURL that it can follow another post?

I don't understand this question. When a POST is sent, the response to that
request can contain a redirection sure. And if libcurl is told to follow
locations, it will do so. The actual HTTP response code number (3xx) in the
response will then tell libcurl if it should do the next request as a GET or
as another POST.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-08-27