Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

json_decode help [duplicate]

Tags:

json

php

vimeo

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

like image 965
nmyster Avatar asked Mar 24 '26 01:03

nmyster


2 Answers

$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.

like image 148
gmadd Avatar answered Mar 26 '26 15:03

gmadd


Did you try the json_decode function?

like image 44
Twelve47 Avatar answered Mar 26 '26 16:03

Twelve47



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!