Page 2 of 2

Resource id #3"1.0"?>

Posted: Wed Sep 22, 2004 4:17 pm
by Calipoop
Oh No! This doestn't seem to be writing to the file... after I open the modified xml file, the only change is at the beginning of the xml file where instead of saying
<?xml version="1.0"?>
it says
Resource id #3"1.0"?>
What is that?


here's the php I'm using:

Code: Select all

<?php
$raw_xml = file_get_contents('php://input');

//ignore the document type
$raw_xml = preg_replace("/\<\?xml.*?\>/", '', $raw_xml);
$raw_xml = trim($raw_xml);

//open the file for reading and writing
$fp = fopen("Stories.xml", "r+b");

//add new story
$storiesFileNew = preg_replace("</stories>", "$raw_xml </stories>", $fp);

//write to file
fwrite($fp, $storiesFileNew);
fclose($fp);

//send to flash
print $raw_xml;
?>
Any idea what I'm screwing up? Also, if I want to read, write and also keep it binary functional, would I use

Code: Select all

<?php
$fp = fopen("Stories.xml", "r+b");
?>

Posted: Wed Sep 22, 2004 7:43 pm
by timvw
you are nowhere reading.