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

curl-and-php

persistent connections

From: e-tones.co.uk <admin_at_e-tones.co.uk>
Date: Tue, 14 May 2002 18:37:38 +0100

I need to use the persistent connection feature of HTTP/1.1 with curl in
PHP but
I don’t know how. I’ve tried everything I can think of but nothing seems
to work reliably.
The code I’m using goes something like:
 
$socket = curl_init("http://localhost");
 
 
$data = "HEAD / HTTP/1.1\nHost: redhat\n\n";
curl_setopt($socket, CURLOPT_TIMEOUT, 3);
curl_setopt($socket, CURLOPT_CUSTOMREQUEST, $data);
curl_setopt($socket, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($socket, CURLOPT_HEADER, 1);
$response_buf = curl_exec($socket);
 
$data = "HEAD /index2.html HTTP/1.1\nHost: redhat\nConnection:
close\n\n";
curl_setopt($socket, CURLOPT_TIMEOUT, 3);
curl_setopt($socket, CURLOPT_CUSTOMREQUEST, $data);
curl_setopt($socket, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($socket, CURLOPT_HEADER, 1);
$response_buf = curl_exec($socket);
 
curl_close($socket);
 
I’m actually trying to achieve something useful but this shows the
basic way I’m trying to use CURL.
 
Open a connection, send my request, get response, …… , send my request
with connection: close, get response and close the socket.
 
I’m presuming this is not correct. I cannot find any information that
will tell me how to do this and I’m hoping that someone
here can help.
 
Thanks
 
Jateen Mistry
 
 
 

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth_at_sourceforge.net
Received on 2002-05-14