I'm trying to fetch data from a password protected JSON feed using curl, but the result adds "Array (" to the beginning of the feed and ")" at the end, making it invalid.
I'm using this code:
<?php
$url = 'https://slx.arlcap.com/sdata/rcs/tablet/products/Y6UJ9A00000Z/filings';
$username = 'xxx';
$password = 'xxx';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt($ch, CURLOPT_HEADER, false);
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
//curl_setopt($ch, CURLOPT_REFERER, $url);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$data = json_decode($result, true);
print_r($data);
?>
And the result is here: http://www.motion.tc//DataTables-1.9.0/examples/ajax/feed.php
Is there a way I can have the data return without the "Array()" element being added?
Thanks! Andrew