Page 1 of 1

Please Help Html_entity_decode

Posted: Mon May 12, 2008 9:21 am
by evin1207
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


i have a script that listens for Data in the body of a POST message. when my script receive the message it comes out in this unencoded format. ive tried to use HTML_ENTITY_DECODE but my ouput is still the same. any help would be great.

Code: Select all

<?php
$putdata = fopen( "php://input" , "rb" );
$dest_xml='/var/www/webupload/scribe.xml';
$file = fopen($dest_xml, "a", 0);
while(!feof( $putdata )) {
fputs($file, html_entity_decode(fread($putdata, 4096)));
fputs($file, "\n");
}
fclose($putdata);
fclose($file);
?>

this is my output

response=%3cresponse%3e%3cexternal-xml%3e%3c%2fexternal-xml%3e%3cexternal-id%3e789456123%3c%2fexternal-id%3e%3caudio-duration%3e15%3c%2faudio-duration%3e%3ctrans-xml%3e%3cmessage%3e%3c%21%5bCDATA%5bThis%20is%20a%20test.%20%20Test%201%2c%202.%20%20Test%201%2c%202%2c%203.%20%201%2c%202%2c%203%2c%204%2c%205%2c%206%2c%207%2c%208%2c%209%2c%2010.%20%20Cohere%20Communications.%5d%5d%3e%3c%2fmessage%3e%3cresult%3etranscribed%3c%2fresult%3e%3c%2ftrans-xml%3e%3cmetadata%2f%3e%3ctruncated%3efalse%3c%2ftruncated%3e%3cerror-code%3e0%3c%2ferror-code%3e%3css-id%3e248279045%3c%2fss-id%3e%3c%2fresponse%3e


~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: Please Help Html_entity_decode

Posted: Mon May 12, 2008 9:48 am
by Verminox
Try urldecode() instead.

Re: Please Help Html_entity_decode

Posted: Mon May 12, 2008 10:22 am
by evin1207
thanks for the info sorry about the script. Im a lil new to php so would i put that in the same spot i have html_entity_decode. ?

Re: Please Help Html_entity_decode

Posted: Mon May 12, 2008 10:45 am
by evin1207
Perfect it works now thanks so much. saved me alot of time.