Reputation:
I have some PHP code which gets the contents from "php://input"
.
if (!isset($HTTP_RAW_POST_DATA)) {
$HTTP_RAW_POST_DATA = file_get_contents("php://input");
Now, I'm trying to remove the XML
tags from $HTTP_RAW_POST_DATA
using sed, like this:
exec("/usr/bin/sed -e 's/\<3\>//g' -e 's/\<\/3\>//g' $HTTP_RAW_POST_DATA");
Then, I try echoing $HTTP_RAW_POST_DATA
like this:
echo("$HTTP_RAW_POST_DATA");
But it still returns it with <3>
and </3>
. Seems like sed can't read the variable.
What can I do to fix this? I get no error messages.
Upvotes: 1
Views: 43
Reputation: 4025
Just use strip_tags() - http://php.net/manual/en/function.strip-tags.php - does exactly what you want sed to do without the horrible security implications.
Upvotes: 1