curl-and-php
belieavable fake visit to a page
Date: Mon, 28 Nov 2005 15:06:55 -0800
Trying to do integrated vbulletin login/logout in a general way. have
it half working. I login on both my site and the internal vb by calling
their login routine via curl and posting it the parameters it wants.
I'd like to logout the same way. One of the parameters logout wants is
a unique logout hash that vb generate. It's included on the forum home
page when you're logged in. One thought I had was to just curl the
forum homepage to myself and scrape it. That doesn't work because the
page curl returns is the logged out version (even though I have fed it
all the cookies). I think I could peek directly into the database and
get it that way but in general how is vb telling the difference between
my "fake" curly page visit and clicking a link to the page?
Here is the code:
$cookiefile = COOKIE_JAR_LOC .
($loginName?$loginName:md5(time()));
//now stuff the cookies IN there
$curlcookies = vbcurlcookies($_COOKIE); //formats them in cookie jar format
$fp=fopen($cookiefile,'w');
fputs($fp,$curlcookies);
fclose($fp);
$ch = curl_init(VB_ROOT . "/index.php" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects if necessary
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
ob_start();
$data = curl_exec($ch);
ob_end_clean();
curl_close($ch);
unset($ch);
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-11-29