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

curl-and-php

Permanent log-in with cookie ?

From: Matteo C. <mathaios76_at_gmail.com>
Date: Thu, 19 Feb 2009 16:24:11 +0100

Greetings to all,
I need to provide some sort of "transparent-login" to my users, that
is logging in an external website without giving away the
user/password. Learning around cURL (which I never used) I found the
following script (do not remember where though :-( )

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://to-external-login');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'data=1234&data2=4567');
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt ($ch,CURLOPT_FOLLOWLOCATION, 1);

$store = curl_exec ($ch);
curl_setopt($ch, CURLOPT_URL, 'http://to-protectd page');
$content = curl_exec ($ch);
curl_close ($ch);

All work perfectly and I can retrieve the contents of the protected
page behind the log-in (I tried before with stream_context_create but
without success...), but what I would like to do is to be able to surf
the website as I were normally authenticated, not retrieving one page
at a time ! It is possible? How could be done ? Any advice is
welcomed, thank you !
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-02-19