Trying to log into a site with the cURL extension of PHP

sokolams

New Member
Basically, I'm trying to log into a site. I've got it logging in, but the site redirects to another part of the site, and upon doing so, it redirects my browser as well.For example:It successfully logs into \[code\]http://example.com/login.php\[/code\]But then my browser goes to \[code\]http://mysite.com/site.php?page=loggedin\[/code\]I just want it to return the contents of the page, not be redirected to it.How would I do this?As requested, here is my code\[code\]// create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, $loginURL); //Some setoptscurl_setopt($ch, CURLOPT_USERAGENT, $agent);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);curl_setopt($ch, CURLOPT_HEADER, false);curl_setopt($ch, CURLOPT_FOLLOWREDIRECT, FALSE);curl_setopt($ch, CURLOPT_REFERRER, $referrer);// $output contains the output string $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch);echo $output; \[/code\]
 
Back
Top