Hey everyone
I'm using cURL with PHP to automate some tasks online, basically logging into a website and going through various pages. I don't want to see any output on the screen when I run my .php script, basically I just need to "fetch" stuff and save it to disk. It functions perfectly, but every page I "visit" with cURL gets printed to my web browser, and it's very annoying!
So is there a way to run cURL WITHOUT printing the source of the page it's fetching? I'll post my code, it's probably a silly mistake:
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, "https:\\www.secure.site.com\login.php");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username=user&password=secret');
curl_setopt($ch, CURLOPT_TIMEOUT, 200);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9');
curl_setopt($ch, CURLOPT_REFERER, 'https:\\www.secure.site.com\index.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$buffer = curl_exec($ch);
curl_close($ch);
Thanks, everyone!