Having trouble parsing this json feed with php, only returns a string instead of an object. Need to return the title and url field for each item.
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$feed = json_decode(get_data('http://xxxx/?json=1&post_type=logos&count=5', TRUE));
var_dump($feed);
?>
<div class="content-box-right">
<h1>LOGO & GRAPHIC STANDARDS</h1>
<div class="content-sep"></div>
<?php foreach ($feed as $item) {
var_dump($item);?>
}
?>
</div>
get_data().