Posted By

Mosaic on 04/22/10


Tagged

xml vimeo


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BrianCoyDesign


Vimeo video number of views


 / Published in: PHP
 

  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  

You need to login to post a comment.