11t1 Posted February 27, 2008 Share Posted February 27, 2008 I'm having issues when trying to parse an XML feed via PHP. I'm getting it to display alright, but there are embedded images in the XML, like <img src="whatever"> and so when it renders as HTML it prints the tags to the screen, not the images. I tried this: $newdesc0 = $item['description']; $newdesc1 = str_replace("<", "\<", $newdesc0); $newdesc2 = str_replace(">", "\>", $newdesc1); and about a hundred permutations thereof to no avail. Where am I going wrong? Link to comment https://forums.phpfreaks.com/topic/93275-str_replace-issues/ Share on other sites More sharing options...
trq Posted February 27, 2008 Share Posted February 27, 2008 Easiest to use htmlspecialchars_decode(). Link to comment https://forums.phpfreaks.com/topic/93275-str_replace-issues/#findComment-477746 Share on other sites More sharing options...
11t1 Posted February 27, 2008 Author Share Posted February 27, 2008 Thank you, indeed. I wasn't even aware of that function. Now that I've slept a bit, I realize I was working on the wrong include file (they have deceptively similar names), but this solution's more elegant than the one I was thinking of. Much appreciated. Link to comment https://forums.phpfreaks.com/topic/93275-str_replace-issues/#findComment-478208 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.