Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- function request($url_) {
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url_);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_USERAGENT, 'blog.inurl.com.br');
- curl_setopt($curl, CURLOPT_REFERER, "http://blog.inurl.com.br/" . intval(rand() % 255) . intval(rand() % 255) . intval(rand() % 255) . intval(rand() % 255));
- return curl_exec($curl);
- }
- $xmlstr = request("http://www.bing.com/search?q=index.php%3Foption%3D");
- $source = <<<HTML
- $xmlstr
- HTML;
- function filtroUrl($html) {
- preg_match_all("#\b((((ht|f)tps?://)|(www|ftp)\.)[a-zA-Z0-9\.\#\@\:%_/\?\=\~\-]+)#i", $html, $match);
- return array_unique($match[0]);
- }
- $doc = new DOMDocument();
- $doc->loadHTML($xmlstr);
- $links = array();
- $arr = $doc->getElementsByTagName("a");
- foreach ($arr as $item) {
- // if (preg_match('#\b((((ht|f)tps?://)|(www|ftp)\.)[a-zA-Z0-9\.\#\@\:%_/\?\=\~\-]+)#i', $item->getAttribute("href"))) {
- $url = filtroUrl($item->getAttribute("href"));
- echo (!is_null($url[0]))? "<br>{$url[0]}</br>" : null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement