Resource id #3"1.0"?>
Posted: Wed Sep 22, 2004 4:17 pm
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
here's the php I'm using:
Any idea what I'm screwing up? Also, if I want to read, write and also keep it binary functional, would I use
it says<?xml version="1.0"?>
What is that?Resource id #3"1.0"?>
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;
?>Code: Select all
<?php
$fp = fopen("Stories.xml", "r+b");
?>