Alright, I'm trying to get a script to visit a website and copy the contents. The problem is that I must fill out a form before I can get to the page I want, but that's not the issue really. The url basically does this.
www.mysite.com/page.php // form is submitted
www.mysite.com/page.php&id=83920 // something here
www.mysite.com/page.php // the page I need
For some reason I can't get from the second url to the third. I figured it might be a redirect link, but I'm not sure now because even with followlocation set to true, I still end up getting the contents of the second url. Here's the code I have in case that might be the issue.
<?php
// INIT CURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'www.mysite.com/page.php&id=83920');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_HEADER, true);
curl_setopt ($ch, CURLOPT_POST, 1);
// Something here possibly, not sure
$output = curl_exec($ch);
$handle = fopen("name.txt", "w");
fwrite($handle,$output);
fclose($handle);
curl_close ($ch);
?>
So, am I using it wrong? What does followlocation do actually (since I can't seem to find that anywhere)? The site mentions that Javascript must be enabled to view the page, would that affect how my script behaves?