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

curl-and-php

Persistent connections ?

From: BAUMEISTER Alexandre <alex_at_finance-net.com>
Date: Fri, 19 Jul 2002 15:06:38 +0200

Bonjour,

  I have 2 queries to do to the same HTTPS server from my PHP scripts.

  Second query depends on result of first query.

  So I tried to write this kind of code :

  $curl_handler=curl_init ();
  curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl_handler, CURLOPT_VERBOSE, 1);
  curl_setopt($curl_handler, CURLOPT_TIMEOUT, 15);
  curl_setopt($curl_handler, CURLOPT_USERAGENT, "Mozilla/5.0 Galeon/1.2.5 (X11; Linux i686; U;) Gecko/20020610 Debian/1.2.5-1");
  curl_setopt($curl_handler, CURLOPT_FAILONERROR, 0);
  curl_setopt($curl_handler, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($curl_handler, CURLOPT_HEADER, 0);
  ...
  curl_setopt($curl_handler, CURLOPT_URL, $URL1);
  $PAGE1 = curl_exec ($curl_handler);
  echo $PAGE1;
  ...
    define $URL2 depending on $URL1
  ...
  curl_setopt($curl_handler, CURLOPT_URL, $URL2);
  $PAGE2 = curl_exec ($curl_handler);
  echo $PAGE2;

  But my problem is that in $PAGE2 I retrieve both pages appended. How
  can I retrieve only the $URL2 page ?

  What is cURL doing exactly at the second curl_exec() ? 2 requests to
  $URL1 and $URL2 or only one request to $URL2 but appending the
  result to previous execution result.

  Is it possible to clean the URL option between the two executions ?

  Regards,
  Alex.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-07-19