fork download
  1. <?php
  2.  
  3. /* update your path accordingly */
  4. include_once 'libs/simplehtmldom/simple_html_dom.php';
  5.  
  6. $search_term = "mobiles";
  7.  
  8. $url = "http://w...content-available-to-author-only...o.in/search?hl=en&q={$search_term}";
  9.  
  10. $html = file_get_html($url);
  11.  
  12. /*
  13. Get all table rows having the id attribute named 'rhsline'.
  14. As the list of sponsored links is in the 'ol' tag; as can be
  15. seen from the DOM tree above; we use the 'children' function
  16. on the $data object to get the sponsored links.
  17. */
  18. $data = $html->find('td[id=rhsline]');
  19.  
  20. /*
  21.   Make sure that sponsors ads are available,
  22.   Some keywords do not have sponsor ads.
  23. */
  24. if(isset($data[0]))
  25. echo $data[0]->children(1);
  26.  
  27. ?>
Runtime error #stdin #stdout 0.03s 13112KB
stdin
Standard input is empty
stdout
Warning: include_once(libs/simplehtmldom/simple_html_dom.php): failed to open stream: No such file or directory in /home/LdDysy/prog.php on line 4

Warning: include_once(): Failed opening 'libs/simplehtmldom/simple_html_dom.php' for inclusion (include_path='.:/usr/share/php5:/usr/share/php') in /home/LdDysy/prog.php on line 4

Fatal error: Call to undefined function file_get_html() in /home/LdDysy/prog.php on line 10