par
ABodyWithAHead » 24 sept. 2012, 15:52
Donc tu as toutes les billes.

Pour le reste c'est comme avec POST, sauf que tu ajoutes pas de données en POST.
<?
$lien = 'http://...../register/?action=login&returnpage=&login_login=XXX&login_password=XXX'; // Le fait qu'il est y une redirection n'influence-pas?
$path_cookie = 'coookies.txt';
if (!file_exists(realpath($path_cookie))) touch($path_cookie);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $lien);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
$return = curl_exec($curl);
curl_close($curl);
$lien2 = 'http://..../homr.php'; //Normalement si l'on est connecté, on devrait voir "Panel" sur home.php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $lien2);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
$return = curl_exec($curl);
echo $return;
curl_close($curl);
unlink($path_cookie);
?>
[quote="xTG"]Donc tu as toutes les billes. ;)
Pour le reste c'est comme avec POST, sauf que tu ajoutes pas de données en POST.[/quote]
[php]<?
$lien = 'http://...../register/?action=login&returnpage=&login_login=XXX&login_password=XXX'; // Le fait qu'il est y une redirection n'influence-pas?
$path_cookie = 'coookies.txt';
if (!file_exists(realpath($path_cookie))) touch($path_cookie);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $lien);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
$return = curl_exec($curl);
curl_close($curl);
$lien2 = 'http://..../homr.php'; //Normalement si l'on est connecté, on devrait voir "Panel" sur home.php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $lien2);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
$return = curl_exec($curl);
echo $return;
curl_close($curl);
unlink($path_cookie);
?>[/php]