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"); } ?> Quote 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. Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/250409-no-tag-stripping/#findComment-1284804 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.