Forums / API
Embedding Vimeo views on my site?
Forums
Forum Rules
-
Be nice
Even if you disagree with someone, keep it civil.
-
Stay on topic
If it’s not relevant, leave it out or start a new thread.
-
Don’t Spam
Re-re-re-re-posts drive us crazy.
-
Respect the Staff
We were members once, just like you.
Our Support Team
-
Mark
-
Ian
-
Tommy
-
Darnell
-
Zena
-
Rebecca
We’re here to help 10am–6pm Eastern, Monday–Friday.
SFP Network Plus
I was wondering if there was a way, through php, of publishing the statistics from Vimeo onto my site where the embedded video is?
Here is the page:
sfpnetwork.org/film.php?v=6307343
Where it says views I'd like to use your total stats for that video instead of my page views counter. It just needs to print plain numbers, like 77.
Brad Dougherty Staff
You can get the number of plays from the Simple API: vimeo.com/api/docs/simple-api#video
Patrick
Hello Brad,
I copy and paste the above script to my website but it failed to display. Could you please tell me why? Thanks.
bestfoodvancouver.com/japanses/
deKO.LT Plus
Maybe can someone explain in easier way how to get that simple number?
Sorry, i'm not a good programmer, just need a little help.
Thanks.
Brad Dougherty Staff
To get the stats on one of your videos in PHP, you could do this:
$curl = curl_init('vimeo.com/api/v2/video/6549503.json';);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($curl);
curl_close($curl);
$video = json_decode($return);
echo $video[0]->stats_number_of_plays;
Just replace "6549503" with the ID of the video you want to get.
deKO.LT Plus
Thank you, works great.
Bakhshi Studio
Hello dear mr and ladys,
Why my video cannot played in this website: (markazhazaraha.de) ?
please help me!
La Lengua
$VIDEO_ID = [Your vimeo video id number]
//OPTION 1: CURL & json_decode
$curl = curl_init(' vimeo.com/api/v2/video/'.$VIDEO_ID.'.json';);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($curl);
curl_close($curl);
$JSON_Data = json_decode($return);
$thumburl = $JSON_Data[0]->thumbnail_small;
$views = $JSON_Data[0]->stats_number_of_plays;
$upload_date = $JSON_Data[0]->upload_date;
$duration = $JSON_Data[0]->duration;
//OPTION 2: file_get_contents & json_decode
$JSON = @file_get_contents("http:// vimeo.com/api/v2/video/".$VIDEO_ID.'.json';);
$JSON_Data = @json_decode($JSON);
$thumburl = $JSON_Data[0]->thumbnail_small;
$views = $JSON_Data[0]->stats_number_of_plays;
$upload_date = $JSON_Data[0]->upload_date;
$duration = $JSON_Data[0]->duration;
//OPTION 3: unserialize & file_get_contents PHP
$hash = unserialize(@file_get_contents("http:// vimeo.com/api/v2/video/".$VIDEO_ID.".php"));
$thumburl = $hash[0]['thumbnail_small'];
$views = $hash[0]['stats_number_of_plays'];
$upload_date = $hash[0]['upload_date'];
$duration = $hash[0]['duration'];
packafoma Plus
I spent considerable time figuring out the best methods to display Vimeo play counts on my web site. I learned a lot and recently put together a tutorial which I think would be helpful to anyone interested in this topic.
Link: packafoma.com/blog/2013/01/06/display-vimeo-play-counts-for-embedded-videos-without-slowing-down-your-site/