How to call url from php using C-url :: alternative to file_get_contents()
Tuesday, July 29, 2008 6:43:55 AM
This is a nice and simple substitute to get_file_contents() using curl, it returns FALSE if $contents is empty.
<?php
function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
curl_close($c);
if ($contents) return $contents;
else return FALSE;
}
?>














Unregistered user # Monday, March 22, 2010 4:10:46 PM
Unregistered user # Wednesday, November 30, 2011 3:21:41 PM