Created
July 7, 2019 23:13
-
-
Save H7-25/ae162631e3a2411a171e8290cb09d3fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$style = "include/style.php"; | |
$js = "include/js.php"; | |
$dom = new DOMDocument; | |
$dom->loadHTMLFile('/home/kiwi/public_html/index.html'); | |
$head = $dom->getElementsByTagName('head')->item(0); | |
$css = $head->getElementsByTagName("link")->item(1); | |
$fh = fopen($style, 'w'); | |
$data = "<link href=".$css->getAttribute("href")." rel=stylesheet>"; | |
fwrite($fh, $data); | |
fclose($fh); | |
$body = $dom->getElementsByTagName('body')->item(0); | |
$scripts = $body->getElementsByTagName("script"); | |
$fh = fopen($js, 'w'); | |
$data = ""; | |
foreach($scripts as $s) { | |
$data .="<script type=text/javascript src=".$s->getAttribute("src")."></script>"; | |
} | |
fwrite($fh, $data); | |
fclose($fh); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment