I am using a regex to grab content of all script tag of an html page. the regex and code I use is like:
$content = file_get_contents($url, false, stream_context_create(
array("http" => array("user_agent" => "any"))
));
$pattern = "/<script[^>]*?>([\s\S]*?)<\/script>/";
preg_match_all($pattern, $content, $inside_script_array);
echo "<pre>";
print_r($inside_script_array);
echo "</pre>";
when I take 1.>
$url = 'http://www.bestylish.com/' ;
it returns me all the script tag . but when I take 2.>
$url = 'http://www.bestylish.com/sale' ;
it doesn't reply me many tags which are same and present in above url 1. What should be the reason ?