I've looked on this site to see if anyone has this exact problem to no avail. I'm trying to download a URL using file_get_contents but while it works when I type the URL of the php script into my browser, the file is not obtained when I run the script via cron.
I've put a mail command to see if anything is returned (I've removed the email addresses themselves) - the body of the email has the URL contents when I run the script directly but it is empty when run via cron
$filen = file_get_contents( "http://forum.forteantimes.com/index.php?forums/ghosts-general.18/" );
$to = "xxxx";
$subject = "test";
$from = "xxxx";
$body=$filen;
$headers="From: xxx\n";
$headers.= "To: \"".$to."\" <".$to.">\n";
$headers.= "Return-Path: <".$from.">\n";
$headers.= "MIME-Version: 1.0\n";
$headers.= "Content-type: text/plain; charset=utf-8\n";
mail($to, $subject, $body, $headers);