Posted By

leandroperes on 01/05/12


Tagged

class simple YouTube


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

White


Simple class to retrieve an ID using a URL of the Youtube


 / Published in: PHP
 

Simple class to retrieve an ID using a URL of the Youtube

  1. <?php
  2. /*
  3.  
  4. Simple Class capture ID Youtube
  5. Leandro Peres - 04/01/0212
  6.  
  7. */
  8.  
  9. class Youtube {
  10. private $url;
  11.  
  12. function PegaID ($url = null) {
  13. $url = substr($url, strpos($url, "v="));
  14. $this->url = str_replace("v=", "", $url);
  15. echo $this->url;
  16. }
  17. }
  18.  
  19. $Youtube = new Youtube();
  20. $ID = $Youtube->PegaID("http://www.youtube.com/watch?v=RmeXANd7c8I");
  21. ?>

Report this snippet  

You need to login to post a comment.