mercredi 27 mai 2015

getting data with curl failed

I'm trying to get the data returned from this link with CURL. However, I'm getting false as the output.

Here's my code and output:

Code:

$url = "http://ift.tt/1FOKLjf";
$ch  = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);

$data = curl_exec($ch);

var_dump( curl_getinfo($ch) );

curl_close($ch);

var_dump($data);

Dump of curl_getinfo call

array (size=26)
'url' => string 'http://ift.tt/1KoKuDt' (length=102)
'content_type' => null
'http_code' => int 0
'header_size' => int 0
'request_size' => int 0
'filetime' => int -1
'ssl_verify_result' => int 0
'redirect_count' => int 0
'total_time' => float 0.702
'namelookup_time' => float 0.249
'connect_time' => float 0.468
'pretransfer_time' => float 0
'size_upload' => float 0
'size_download' => float 0
'speed_download' => float 0
'speed_upload' => float 0
'download_content_length' => float -1
'upload_content_length' => float -1
'starttransfer_time' => float 0
'redirect_time' => float 0
'redirect_url' => string '' (length=0)
'primary_ip' => string '107.22.197.175' (length=14)
'certinfo' => 
   array (size=0)
     empty
'primary_port' => int 443
'local_ip' => string '192.168.1.17' (length=12)
'local_port' => int 53767

Dump of $data

boolean false

Is there something I'm doing wrong?




Aucun commentaire:

Enregistrer un commentaire