I'm trying to store data exposed with the following URL in a PHP variable ($curl_response) for further manipulation, but my current code is not executing properly. I've copied/pasted the data exposed in the following URL into the body of an HTML file and have tried running the below script on that HTML file, and CURL works properly. I'm guessing the issue then has to do with getting a response correctly from this particular site. Perhaps there is a CURL option I'm overlooking.
http://tdm.prod.obanyc.com/api/pullouts/agency/MTABC/list
Thoughts?
<?php
$ch = curl_init("http://tdm.prod.obanyc.com/api/pullouts/agency/MTABC/list");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($ch);
if ($curl_response === false) {
$info = curl_getinfo($ch);
curl_close($ch);
die('error occured during curl exec. Additioanl info: ' . var_export($info));
}
else echo $curl_response ;
curl_close($ch);
?>
The debugging output is:
array ( 'url' => '', 'content_type' => NULL, 'http_code' => 0, 'header_size' => 0, 'request_size' => 0, 'filetime' => -1, 'ssl_verify_result' => 0, 'redirect_count' => 0, 'total_time' => 63.145232, 'namelookup_time' => 0.006015, 'connect_time' => 0, 'pretransfer_time' => 0, 'size_upload' => 0, 'size_download' => 0, 'speed_download' => 0, 'speed_upload' => 0, 'download_content_length' => -1, 'upload_content_length' => -1, 'starttransfer_time' => 0, 'redirect_time' => 0, 'certinfo' => array ( ), 'primary_ip' => '10.137.36.11', 'primary_port' => 80, 'local_ip' => '', 'local_port' => 0, 'redirect_url' => '', )error occured during curl exec. Additioanl info: