Page 1 of 1

extracting CDATA php4 please help

Posted: Mon May 12, 2008 3:20 pm
by evin1207
This script reads messages in the body of a Raw post message

I need to be able to get certain feild from the xml that is created but cannot get any methods to work

i would like to get the cdata that is in the created xml file into another file or just extract the cdata from the original post message into the file that is created

:banghead:

Code: Select all

 
<?php
$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 )) {
fputs($file, urldecode(fread($putdata, 4096)));
fputs($file, "\n");
}
fclose($putdata);
fclose($file);
?>
 

this is my output

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.  (??) Communications.]]></message><result>transcribed</result></trans-xml><metadata/><truncated>false</truncated><error-code>0</error-code><ss-id>251262895</ss-id></response>

any help would be appreciated thanks

Re: extracting CDATA php4 please help

Posted: Fri May 16, 2008 3:08 pm
by kendall