Page 1 of 1

Need Help cant remove certain feilds from files

Posted: Wed May 14, 2008 8:12 am
by evin1207
I want to manipluate the string $xml but im having dificulty ive str_replace with no luck any i deas

Code: Select all

 
<?php
$xml = "";
$putdata = fopen( "php://input" , "rb" );
$dest_xml='/var/www/webupload/scribe'.date("H:i:s").".xml";
$file = fopen($dest_xml, "a", 0);
while(!feof( $putdata )) {
$_data = fread($putdata, 4096);
$_data = urldecode($_data);
$xml = $xml.$data;
}
$response = str_replace("response=","","$xml");
fclose($putdata);
fclose($file);
?>
 
:banghead:


this is my ouput with out the str_replace.

Code: Select all

 
response=<response><external-xml></external-xml><external-id>789456123</external-id><audio-duration>15</audio-duration><trans-xml><message><![CDATA[This is a test.  Test 1, 2.  Test 1 2 3.  1, 2, 3, 4, 5, 6, 7, 8, 9, 10.  (??) here communication.]]></message><result>transcribed</result></trans-xml><metadata/><truncated>false</truncated><error-code>0</error-code><ss-id>254126455</ss-id></
 

any help would be very appreciated.

Re: Need Help cant remove certain feilds from files

Posted: Thu May 15, 2008 12:48 pm
by Dutchben
First i've noticed that in your example your not building $xml correctly
# $_data = fread($putdata, 4096);
# $_data = urldecode($_data);
# $xml = $xml.$data;
should be
# $_data = fread($putdata, 4096);
# $_data = urldecode($_data);
# $xml = $xml.$_data;
or $xml .= $_data; for schort

$response = str_replace("response=","","$xml"); is correct. How are you outputting?