this returns to me the result, which shows the index.php @ remotesite.com with me logged in.
however, when i click logout.
they end up http://localhost/logout.php
instead of http://remotesite.com/logout.php
when i go to remotesite.com , i am not logged in.
my suspcion is that i can do POST fine with curl, however, redirecting uses GET, therefore completely ignoring the POST variables being originally sent out.
however i found http://www.clipperz.com
it does this somehow. i can login from clipperz.com and it will redirect me to the page and i am logged in.
basically i have googled, and read curl manual, but no straw. i have seen similar posts trying to redirect after POST without losing post variables, and they had no real solution.
i really do not want to resort to fsockopen().....
but if something works with fsockopen or curl please post here.
thank you.
Code: Select all
hitForm($loginURL, $loginFields);
function hitForm($loginURL, $loginFields, $referer="") {
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_URL, $loginURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $loginFields);
curl_exec($ch);
curl_close($ch);
}
?>