I am trying to display content from a txt file on a remote server using a cURL if the function file_get_contents is not turned on on their server. Right now, I have it set up as:
$updatelog ='http://www.linktoremotsite.com/updatelog.txt';
if(function_exists('file_get_contents')){
$log = file_get_contents($updatelog);
}else{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $updatelog);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$log = curl_exec($ch);
curl_close($ch);
}
echo '<div>' . $log . '</div>';
and the file_get_contents works fine, but for those that don't have that enabled on their site, I like them to be able to use a curl to see the contents of the .txt file. But I can't seem to get the contents of the .txt file to display.
The .txt file does have some HTML in it for the file_get_contents to display neatly, but not much and I like to keep that with the curl if possible.