cURL / Mailing Lists / curl-users / Single Mail

curl-users

How to retrive 2 differentes pages in a single curl request...

From: Lorenzo Ponce <lekronne_at_yahoo.com>
Date: Mon, 14 Apr 2008 19:39:15 -0500 (CDT)

Hi there...
   
  I'm trying to get some data from a website, which needs to be logged in. The loggin sessions are not persistent, so, if i close the curl script, then starting another one, the session would be expired...
   
  The login process is with a POST form (of course), then, the data must be retrived with GET (loading a standard page)... I suppose many of you habe done this, but i can't do it...
   
  What i have is this:
   
  $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "url The login page");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=theUser¶passwd=thePass");
$resultado1=curl_exec($ch);
$error1=curl_errno($ch);
   
  curl_setopt($ch, CURLOPT_URL, "url The search with get params page");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$resultado2=curl_exec($ch);
$error2=curl_errno($ch);
  curl_close($ch);
   
  echo $resultado2;
   
  I know this isnt elegant... so, if you can help with this...
   
  Thanks.

       
---------------------------------

¡Capacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:
http://correo.espanol.yahoo.com/
Received on 2008-04-15