Pyr3x Posted November 3, 2011 Share Posted November 3, 2011 I have a small script that prints the contents of a log on my server but it's removing tags from the output. An example would be: <username> data here is being printed as: data here removing: <username> I do not want it to strip these out of the output. How do I avoid this? <? $cmd = "tail -5 /opt/mserver/server.log"; exec("$cmd 2>&1", $output); foreach($output as $outputline) { print ("$outputline\n"); } ?> Link to comment https://forums.phpfreaks.com/topic/250409-no-tag-stripping/ Share on other sites More sharing options...
Pikachu2000 Posted November 3, 2011 Share Posted November 3, 2011 I'll bet the tags are there, and you'd probably see them if you do a View ---> Source. To allow them to be displayed, rather than interpreted by the browser, use htmlentities when you echo them. Link to comment https://forums.phpfreaks.com/topic/250409-no-tag-stripping/#findComment-1284802 Share on other sites More sharing options...
Pyr3x Posted November 3, 2011 Author Share Posted November 3, 2011 wow, thanks a lot man! I was looking all over google for this! I used: echo htmlentities ("$outputline\n"); It worked great! Link to comment https://forums.phpfreaks.com/topic/250409-no-tag-stripping/#findComment-1284804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.