I've googled a lot right now and just can not find the answer.
I have a PHP that logs in to a site and downloads a pdf file using cURL. This is my code:
<?php
require ("test_pass.php");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://rapid.deltion.nl/user/login/');
curl_setopt($ch, CURLOPT_POSTFIELDS,'username='.urlencode($login_email).'&password='.urlencode($l ogin_pass).'&login=Login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/my_cookies.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_setopt($ch, CURLOPT_REFERER, "https://rapid.deltion.nl/student/info/");
$page = curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, 'https://rapid.deltion.nl/student/pdfresultaten/id/97041344/Luuk%20Wuijster.pdf' );
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/my_cookies.txt");
$Result = curl_exec($ch);
header('Cache-Control: public');
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="cijferlijst.pdf"');
header('Content-Length: '.strlen($Result));
echo $Result;
eventually I want to run this code every hour with a cronjob and compare the pdf with the pdf it downloaded one hour ago.
The problem is that it downloads the pdf to my own computer when I go to the url. So I tried to run the script from my server but that didn't work either.