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

curl-and-php

Re: session

From: Cenk Uysal <cenk_uysal_at_yahoo.com>
Date: Mon, 3 Feb 2003 07:39:19 -0800 (PST)

here is my code(PHP):

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

ob_start();
                                
$ch =
curl_init("http://member.xxx.net/signin/auth.asp?MemberID=myid&Password=mypassword&rurl=http://www.xxx.com");

curl_setopt($ch, CURLOPT_HEADER, 1);
                        
$de = curl_exec($ch);
                        
$buffer = ob_get_contents();
ob_end_clean();
                        
if (!$buffer)
{
  echo "no buffer!";
  echo curl_error($ch);
  exit;
}
                        
curl_close($ch);

$array = explode("\n", $buffer);
for ($i=0; $i<sizeof($array); $i++)
{
  if (strstr($array[$i],"Set-Cookie:"))
  {
    $cookie = trim(str_replace("Set-Cookie:","",$array[$i]));
  }
}
                        

ob_start();
                        
$ct =
curl_init("http://www.xxx.net/market/offerview.asp?cat=s&no=302400&format=2");
                                
curl_setopt($ct, CURLOPT_COOKIE, "$cookie");
                                                
$de = curl_exec($ct);
                        
$buffer = ob_get_contents();
ob_end_clean();
                        
if (!$buffer)
{
  echo "no buffer!";
  echo curl_error($ct);
  exit;
}

echo "$buffer\n";
curl_close($ct);

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

first i pass username and password arguments to auth.asp
when it checks for their validation, it redirects me to the url given
in the rurl argument. a session is created and redirected url checks
for this session.

so what i try to do is first getting session id from the header of
first connection. and use this cookie header in the second
connection. i can do it.

second connection is established with directly the url, which i want
to go. this page checks for the session var. it is the page that
auth.asp redirects me.

with this code, i get "no buffer" error. nothing else.

any help will be great help...

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
Received on 2003-02-03