Googleinurl

MOTOR SCANNER DORK Filtro DOMDocument

Jul 5th, 2014
851
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. error_reporting(0);
  4.  
  5. function request($url_) {
  6.     $curl = curl_init();
  7.     curl_setopt($curl, CURLOPT_URL, $url_);
  8.     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  9.     curl_setopt($curl, CURLOPT_USERAGENT, 'blog.inurl.com.br');
  10.     curl_setopt($curl, CURLOPT_REFERER, "http://blog.inurl.com.br/" . intval(rand() % 255) . intval(rand() % 255) . intval(rand() % 255) . intval(rand() % 255));
  11.     return curl_exec($curl);
  12. }
  13.  
  14. $xmlstr = request("http://www.bing.com/search?q=index.php%3Foption%3D");
  15. $source = <<<HTML
  16. $xmlstr      
  17. HTML;
  18.  
  19. function filtroUrl($html) {
  20.     preg_match_all("#\b((((ht|f)tps?://)|(www|ftp)\.)[a-zA-Z0-9\.\#\@\:%_/\?\=\~\-]+)#i", $html, $match);
  21.     return array_unique($match[0]);
  22. }
  23.  
  24. $doc = new DOMDocument();
  25. $doc->loadHTML($xmlstr);
  26. $links = array();
  27.  
  28. $arr = $doc->getElementsByTagName("a");
  29. foreach ($arr as $item) {
  30. //  if (preg_match('#\b((((ht|f)tps?://)|(www|ftp)\.)[a-zA-Z0-9\.\#\@\:%_/\?\=\~\-]+)#i', $item->getAttribute("href"))) {
  31.     $url = filtroUrl($item->getAttribute("href"));
  32.     echo (!is_null($url[0]))? "<br>{$url[0]}</br>" : null;
  33. }
RAW Paste Data