I try to download file using a php-script from an URL like the following:
http://www.xcontest.org/track.php?t=2avxjsv1.igc
The code I use looks like the following, but it produces empty download files only:
$DLFile= "testfile.igc";
$DLURL="http://www.xcontest.org/track.php?t=2avxjsv1.igc";
$fp = fopen ($DLFile, 'w+');
$ch = curl_init($DLURL);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
An other strange thing is when entering the URL in the web browser I don't get the file. It can I could only download the file when clicking the link on the web site!.
Any advice is very appreciated!
Give this a go
#or if you want to put it within a loop for parsing several links... you need some functions.. here is a rough idea....