Answer the question
In order to leave comments, you need to log in
"Simple HTML DOM Parser" how to remove tags?
There is an HTML code:
<html>
<head><meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<style type="text/css">
<!--
span.cls_004{font-family:Arial,serif;font-size:18.1px;color:rgb(255,255,255);font-weight:bold;font-style:normal;text-decoration: none}
-->
</style>
<script type="text/javascript" src="Utah motorcycleFactSheet2012_files/wz_jsgraphics.js"></script>
</head>
<body>
<div style="position:absolute;left:50%;margin-left:-306px;top:0px;width:612px;height:792px;border-style:outset;overflow:hidden">
<div style="position:absolute;left:0px;top:0px">
<img src="Utah motorcycleFactSheet2012_files/background1.jpg" width=612 height=792></div>
<div style="position:absolute;left:29.88px;top:32.86px" class="cls_004"><span class="cls_004">2012 Utah Crash Facts</span></div>
</div>
</body>
</html>
<html>
<head><meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<script type="text/javascript" src="Utah motorcycleFactSheet2012_files/wz_jsgraphics.js"></script>
</head>
<body>
</body>
</html>
//if(isset($_POST['k1'])){}
//$k1 = $_POST['k1'];
include('simple_html_dom.php');
$html = new simple_html_dom();
$html->load('<html>
<head><meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<script type="text/javascript" src="Utah motorcycleFactSheet2012_files/wz_jsgraphics.js"></script>
</head>
<body>
</body>
</html>');
$element = $html->find("html");
$element = null;
echo $html->save();
Answer the question
In order to leave comments, you need to log in
I just extracted "style" (Reads the entire HTML of the element, including itself) and "body" (Reads the inner HTML of the element) from the HTML code.
include('simple_html_dom.php');
$html = new simple_html_dom();
$html = str_get_html($k1);
$style = $html->find('style',0);
echo $style->outertext;
$body = $html->find('body',0);
echo $body->innertext;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question