I have been trying to use some API's from various services, At the moment im trying to retrieve data about a video on vimeo,
I have successfully got the file and read the contents, however, i do not know how to access each part of the file that is returned as a .json.
Basically, how do i access the data in the json file using PHP
Thanks
$file_contents = file_get_contents("http://vimeo.com/api/v2/group/awesome/videos.json"), true);
Read it into a variable using:
$data = json_decode($file_contents);
then you can access the parts using:
echo $data->id;
echo $data->title;
etc.
Just use print_r($data); to see all available fields.
Did you try the json_decode function?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With