trying to get property of non object curl issue
- by user550265
I have a curl setup as follows to access a json object
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://sitename.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookiefilename.txt');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host:sitename.com'));
$output = curl_exec($ch);
curl_close($ch);
$output = json_decode($output);
echo $output->property;
I get the error 'trying to access property of non object'.