Strip html tags using php as bash one-liner

The following takes input from standard in and strips all html tags


php -R 'echo strip_tags($argn)."\n";'

So this example


echo "<cage who knows why='angelou'>bird</cage>" | php -R 'echo strip_tags($argn)."\n";'

produces


bird

Source: This actually comes straight from the man page for php.

Tags: ,

Leave a Reply