<?php
$url='http://www.imdbapi.com/?t=True%20Grit&y=1969';
$json = get_data($url);
var_dump(json_decode($json));
var_dump(json_decode($json, true));
/* gets the data from a URL */
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;
}
?>
Ok this is grabbing the data and vardumping it now. All i want to know how to access certain bits for example $title = JSON TITLE? i cant find how to access certain bits.
Yeah sorry about that im still learning.
Thanks LP