How to workaround PHP advanced html dom's conversion of entities? -


how can workaround advanced_html_dom.php str_get_html's conversion of html entities, short of applying htmlentities() on every element content?

despite

http://archive.is/ywkyp#selection-971.0-979.95

the goal of project dom-based drop-in replacement php's simple html dom library.

... if use file/str_get_html don't need change anything.

i find on

include 'simple_html_dom.php'; $set = str_get_html('<html><title>&nbsp;</title></html>'); echo ($set->find('title',0)->innertext)."\n";  // expected: &nbsp;  observed: &nbsp; 

changing advanced html dom gives incompatible result:

include 'advanced_html_dom.php'; $set = str_get_html('<html><title>&nbsp;</title></html>'); echo ($set->find('title',0)->innertext)."\n";    // expected: &nbsp;  observed: -á 

this issue not confined spaces.

$set = str_get_html('<html><body>&bull;</body></html>');  echo $set->find('body',0)->innertext; // expected $bull; observed ÔÇó 

you can check own package phphtmlquery, helps use php select html element using of css3 selectors.

the package works external links , internal html files too.

installation

open terminal , browse project root folder , run

composer require "abdelilahlbardi/phphtmlquery":"@dev" 

documentation

for more informations, please visit package link: phphtmlquery


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -