Noob Question - PHP to XML
Posted: Sun May 25, 2008 4:42 pm
Hi All,
I am having trouble writing a php script to have the data be written into xml. I am trying to take the variables from flash and have it run through a php script and write into an xml file. I am trying to tweak a php script that I know works that used to send me an email but now instead of sending me an email I want it to write the data it collects into an xml file but am currently having issues. Any help at all is greatly appreciated. Thanks in advanced,
BC
I am having trouble writing a php script to have the data be written into xml. I am trying to take the variables from flash and have it run through a php script and write into an xml file. I am trying to tweak a php script that I know works that used to send me an email but now instead of sending me an email I want it to write the data it collects into an xml file but am currently having issues. Any help at all is greatly appreciated. Thanks in advanced,
BC
Code: Select all
<?php
// read the variables from flash
$name = $_POST['yourname'];
$email = $_POST['youremail'];
$message = $_POST['yourmessage'];
// include sender IP in the message.
$ipaddress = "Sender's IP Address: " . $_SERVER['REMOTE_ADDR'];
// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name);
$email = stripslashes($email);
$message = stripslashes($message);
// write to xml file
if(isset($name) and isset($email) and isset($message)){
$handle = fopen("/guestbook.xml", "w");
fwrite($handle, $name, $email, $ipaddress, $message);
}
?>