curl-and-php
RE: cURL easy in PHP
Date: Fri, 13 Sep 2002 14:38:15 -0400 (EDT)
>
> > I am unclear if PHP's cURL supports the curl_easy functions:
> > curl_easy_init(), curl_easy_setopt, curl_easy_perform(), and
> > curl_easy_cleanup().
>
> The PHP/CURL module supports those functions, yes, but it uses
> slightly different names: http://www.php.net/manual/en/ref.curl.php
Thanks Daniel,
I assume you mean curl_init(), curl_setopt, curl_exec().
I was hoping to use a persistant connection with the curl_easy functions to try to speed retrieval of multpile files from the same host but from within a PHP script. From the cURL documentation I gather this can be done by reusing the same file handle for subsequent calls to curl_easy_perform()?
--- libcurl version 7.7 or later: ( http://curl.haxx.se/libcurl/c/curl_easy_perform.html )
You can do any amount of calls to curl_easy_perform() while using the same handle. If you intend to transfer more than one file, you are even encouraged to do so. libcurl will then attempt to re-use the same connection for the following transfers, thus making the operations faster, less CPU intense and using less network resources. Just note that you will have to use curl_easy_setopt between the invokes to set options for the following curl_easy_perform. ---
When I attempted to reuse the file handle from the PHP curl_init() call with a subsequent curl_exec(), resetting the CURLOPT_URL in between for the next retrieval, PHP generates an error: Can not reuse file handle.
I thought there should be PHP calls to the specific curl_easy functions that allow this since that functionality is available in libcurl 7.7 and above? My host currently has curl-7.9.5 istalled with their PHP version 4.1.2.
Dan O.
------------------------------------------------
Changed your e-mail? Keep your contacts! Use this free e-mail change of address service from Return Path. Register now!
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-09-13