phpinfo() shows cURL enabled, I'm still unable to use it
Use this function. There is no get_data
function:
<?phpfunction file_get_contents_curl($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); curl_close($ch); return $data;}echo file_get_contents_curl("http://www.google.com/");?>
I'm not an expert using cUrl... but I've never heard about that get_data() function being part of cUrl.
http://es.php.net/manual/en/book.curl.php
To make a query you must create a curl instance:
$curl = curl_init( $url );
And then you can execute the query with:
curl_exec( $curl );
...basically.
With curl_setopt (http://es.php.net/manual/en/function.curl-setopt.php) you can set various options (I'm sure you will need to).
One option specially useful that makes curl even easer to use is:
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
This makes curl_exec() to return a string with the content of the response.
So the whole example ends like:
$url = 'http://www.google.com'; $curl = curl_init( $url ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); $content = curl_exec( $curl ); echo "The google.com answered=".$content;