php - Parsing an img src with DOM returns only the first character of string -
$doc = new domdocument(); $document=$doc->loadhtml($introtext); $imageparse = $doc->getelementsbytagname('img'); $i=0; foreach ($imageparse $parser) { $images[$i]= $parser->getattribute('src'); $i++; } var_dump($images[0]);
introtext var:
<p>ssdasadssdasadssd</p> <p>ssdasad</p> <p>ssdasad</p> <p>ssdasad</p> <p><img src="images/images.jpg" alt="" /></p> <p>ssdasad</p> <p> </p> <p> </p>
var_dump($images[]) returns first character of string,instead of whole string. example: "images/images.jpg" = . if set src="gotrekt" , "g" output. funny thing yesterday in home used same code , worked,i copy pasted files usb today in work.
also notice var_dump($introtext) give :
this isnt legit right ? shouldnt shows html tags instead of getting executed? $introtext
content of joomla articles maybe not coding joomla issue @ end ? removed security patterns articles still nothing changed.
Comments
Post a Comment