Thursday, June 27, 2019

php - how to separate selected tags from html content

I have an html like



 

Dr. Maria Steffens


Institute of Medico




Sta. Ana, strt PH-501


1062 Caracas



France



Telefon: +58-457-2889567


plasticsurgery@yahoo.com


www.mysite.com





Now i want to separate every tag like




Dr. Maria Steffens




or occurrence of



tag


I have tried




$html = new DOMDocument();
@$html->loadHtmlFile('http://www.sitetofetch.com');
$xpath = new DOMXPath( $html );
$nodelist = $xpath->query( "//*[@class='address']" );

foreach ($nodelist as $n){
$newhtml = $html->saveHtml($n)."\n";
$newhtml = htmlentities($newhtml);

$items = $html->getElementsByTagName('h1');

}


but its not working properly,



How can i do that.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...