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>&nbsp;</p> <p>&nbsp;</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 :

enter image description here

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

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -