This code is just reading html and printing , eventually I want to
modify the html. However, the original html contains javascript and
the output html contains tags not in the original.
$url = "http://www.something.c om";
$doc = new DOMDocument();
$doc->loadHTMLFile($ url);
print $doc->saveHTML();
Original html snippet:
function exampleFunction () {
var doc = '<html><head>' ;
doc += '<title>Title</title>';
doc += '</head>';
doc += '<body onload="self.fo cus();">';
doc += '</body></html>';
}
Html after saveHTML:
function exampleFunction () {
('about:blank', 'imagemanagerpo pup',settings);
var doc = '<html><head>' ;
doc += '<title>Title</title>';
doc += '</script>
</head>
<body>
<p>';
doc += '</body>
</html><html><bod y>
<p>';
}
Extra tags to end the script, head and begin a new body are being
added before the </bodytag and after the <body onload=self.foc us()>
tag in the js variable. Is there a way for the Dom to leave the
javascript as is without trying to 'fix' the html ? The changes being
made are causing a javascript error.
Thanks
modify the html. However, the original html contains javascript and
the output html contains tags not in the original.
$url = "http://www.something.c om";
$doc = new DOMDocument();
$doc->loadHTMLFile($ url);
print $doc->saveHTML();
Original html snippet:
function exampleFunction () {
var doc = '<html><head>' ;
doc += '<title>Title</title>';
doc += '</head>';
doc += '<body onload="self.fo cus();">';
doc += '</body></html>';
}
Html after saveHTML:
function exampleFunction () {
('about:blank', 'imagemanagerpo pup',settings);
var doc = '<html><head>' ;
doc += '<title>Title</title>';
doc += '</script>
</head>
<body>
<p>';
doc += '</body>
</html><html><bod y>
<p>';
}
Extra tags to end the script, head and begin a new body are being
added before the </bodytag and after the <body onload=self.foc us()>
tag in the js variable. Is there a way for the Dom to leave the
javascript as is without trying to 'fix' the html ? The changes being
made are causing a javascript error.
Thanks
Comment