I am getting script from some url like this
$dom = new DomDocument();
$url = "http://www.example.com";
@$dom->loadHTMLFile($url);
foreach($dom->getElementsByTagName('*') as $element ){
if ($element->tagName == 'script' && strpos($element->getAttribute('src'), '.js') == true)
{
$files = $element->getAttribute('src');
$link[]=$files;
}
}
$domc = new DomDocument();
foreach($link as $ln ){
$html = file_get_contents($ln);
$script = $html;
print_r ($script);
}
Everything is working as expected, but if I have inside script append function I am missing everything inside quotes. For example this:
$(".divc").append("<div></div>")
gives me in php output
$(".divc").append("")
Why is this happening?
<div></div>are considered as html tags