Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // by seidbenseid
- // from arabia.io
- // algerian HaXoor
- function get_all_urls ($url) {
- if (function_exists ("curl_exec")) {
- $ch = curl_init ($url);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:35.0) Gecko/20100101 Firefox/35.0");
- curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt ($ch, CURLOPT_HEADER, false);
- curl_setopt ($ch, CURLOPT_ENCODING, false);
- $data = curl_exec ($ch);
- }
- else
- $data = file_get_contents ($url);
- $urls = array ();
- if (preg_match_all ('#<a\s*(.*?)>#i', $data, $attrs)) {
- foreach ($attrs[1] as $attr) {
- if (preg_match ('#href\s*=\s*(\'|")(.*?)(\'|")#i', $attr, $href)) {
- if ($href[2] && !in_array ($href[2], $urls))
- $urls[] = $href[2];
- }
- }
- }
- return $urls;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement