Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $pslManager = new PublicSuffixListManager();
- $parser = new Parser($pslManager->getList());
- $pattern = "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i";
- $debug = true;
- if ($debug) {
- echo "<pre>";
- }
- foreach($js_scripts as $js_script){
- $url = $js_script->src;
- $tmpSubdomain = NULL;
- $scriptId = "";
- $domainFoundFlag = false;
- if(!preg_match($pattern,$url)) // if url is valid
- {
- if ($debug) {
- echo "Invalid URL ==== {$url} ===================================</br>";
- }
- continue;
- }
- //remove query string trom url
- $dbPattern = preg_replace('/\?.*/', '', $url);
- //extract domain from url
- $domain = _getDomainFromURL($url);
- $urlNew = new \Purl\Url($domain);
- $isIpAddress = filter_var($domain, FILTER_VALIDATE_IP);
- $mainDomain = $parser->getRegisterableDomain($urlNew);
- $tmpSubdomain = $parser->getSubdomain($urlNew);
- $mainDomain=_getDomainFromURL($mainDomain);
- $tmpSubdomain=_getDomainFromURL($tmpSubdomain);
- $subDomain = (!empty($tmpSubdomain)) ? $tmpSubdomain . "." . $mainDomain : NULL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement