Vimeo video number of views


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?
  2. $video = "5144569";
  3. $xml_data = @file_get_contents("http://vimeo.com/api/clip/".$video.".xml");
  4. $parser = xml_parser_create('UTF-8');
  5. xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
  6. xml_parse_into_struct($parser, $xml_data, $vals, $index);
  7. xml_parser_free($parser);
  8.  
  9. $thumb_index = $index['STATS_NUMBER_OF_PLAYS'][0]; //restituisce l'indice dell'array che contiene le stats
  10. $n_views = $vals[$thumb_index]['value'];
  11. echo $n_views;
  12. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.