Clear data from php html page
I need to clear data from html page
<div style="margin-top: 0px; padding-right: 5px;" class="lftFlt1">
<a href="" onclick="setList1(157204);return false;" class="contentSubHead" title="USA USA">USA USA</a>
<div style="display: inline; margin-right: 10px;"><a href="" onclick="rate('157204');return false;"><img src="http://icdn.raaga.com/3_s.gif" title="RATING: 3.29" style="position: relative; left: 5px;" height="10" width="60" border="0"></a></div>
</div>
I need to clear US USA and 157204 from onclick="setList1...
0
Ram
source
share5 answers
You must use DOMDocument or XPath . RegEx is usually not recommended for HTML parsing.
+2
To date, the best lib for curettage is a simple html dom. mainly uses jquery selector syntax.
http://simplehtmldom.sourceforge.net/
How do you get the data in this example:
include("simple_html_dom.php");
$dom=str_get_html("page.html");
$text=$dom->find(".lftFlt1 a.contentSubHead",0)->plaintext;
//or
$text=$dom->find(".lftFlt1 a.contentSubHead",0)->title;
0