Advertisement
Guest User

kodeimdb

a guest
Sep 1st, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. function getImdb($fullpath){
  2. $imdb['rating']="";
  3. $imdb['storyline']="";
  4. $imdb['details']="";
  5. $imdb['ttcode']="";
  6.  
  7.  
  8. $doc = new DOMDocument();
  9. $doc->loadHTMLFile($fullpath);
  10. $finder = new DomXPath($doc);
  11.  
  12. $ns_rating = $finder->query("//span[contains(@itemprop, 'ratingValue')]");
  13. $n_rating=$ns_rating->item(0);
  14. $imdb['rating']=$n_rating->nodeValue;
  15.  
  16. $ns_storyLine= $finder->query("//div[contains(@id, 'titleStoryLine') and contains(@class,'article') ]");
  17. $n_storyLine=$ns_storyLine->item(0);
  18. $imdb['storyline']=getInnerHTML($n_storyLine);
  19.  
  20. $ns_details= $finder->query("//div[contains(@id, 'titleDetails') and contains(@class,'article') ]");
  21. $n_details=$ns_details->item(0);
  22.  
  23. $ns_ttcode= $finder->query("//meta[contains(@property, 'url')]");
  24. $n_ttcode=$ns_ttcode->item(0);
  25. $imdb['ttcode']=$n_ttcode->getAttribute("content");
  26. $imdb['ttcode']=substr($imdb['ttcode'],26,9);
  27.  
  28. //remove all tag a href, except node value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement