cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: Where to put ca-bundle.net

From: David Felton <davidfelton_at_codemasters.com>
Date: Thu, 28 Aug 2003 10:56:40 +0100

I'm using cURL to post data to a server, I retrieve the result of the post
using CURLOPT_RETURNTRANSFER.

Part of my project requires that I POST quite a large number of transactions
to the same server using cURL, one after the other. Is there a way I can
send all the transactions across the same connection and still retrieve the
result, rather than having to open a new connection each time?

Opening a connection can be quite time consuming and I'm concerned that if
this has to be done a lot on one page it could result in page timeouts.

I'm hoping something like the following is possible:

curl_setopt($ch, CURLOPT_URL,"<server to post to>");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_POST, 1);

foreach(<item to post>)
    {
    curl_setopt($ch, CURLOPT_POSTFIELDS, "<data to post>");
    $resultxml=curl_exec($ch);
    $lastcurlerror=curl_error($ch);
    
    //process the result

    }
curl_close($ch);

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

**********************************************************************

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-08-28