july09 Posted July 9, 2007 Share Posted July 9, 2007 Hey all I'm writing my first PHP program which is supposed to fetch an external HTML source and display it. I have the HTML source stored as the variable $pageContents, but when I try to echo it out the browser renders the HTML. This is understandable, but can I somehow just output the raw HTML code without the browser trying to render it? Cheers Link to comment https://forums.phpfreaks.com/topic/59149-escaping-html-while-using-echo/ Share on other sites More sharing options...
chocopi Posted July 9, 2007 Share Posted July 9, 2007 I don't know the clever way of doing it but you could always put it into a textarea ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/59149-escaping-html-while-using-echo/#findComment-293720 Share on other sites More sharing options...
marcus Posted July 9, 2007 Share Posted July 9, 2007 htmlspecialchars() Link to comment https://forums.phpfreaks.com/topic/59149-escaping-html-while-using-echo/#findComment-293727 Share on other sites More sharing options...
july09 Posted July 9, 2007 Author Share Posted July 9, 2007 thanks for the help, I used strip_tags($pageContents); and voila, it even strips away all that nasty HTML which I didn't need in the first place. This would've taken me 2 hours to do in J2EE Link to comment https://forums.phpfreaks.com/topic/59149-escaping-html-while-using-echo/#findComment-293735 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.