Problems with strings containing
Posted on 16th Feb 2014 07:03 pm by admin

Hey all,

I have encountered something strange in a script. I am trying to write an XML header and then fill in the file:
Code: $xmlFile = "fetchableData.xml";
Did you know?Explore Trending and Topic pages for more stories like this.
$fh = fopen($xmlFile, 'r+');

$housingData = updateHousingAndReturnXML();
$xmlData = '<?xml version="1.0" ?>'.$housingData;

// echo $xmlData;

fwrite($fh,$xmlData);
fclose($fh);
This code fills the file with the contents of $housingData, but <?xml version="1.0" ?> is not added. If I break up <? it will add it but then I get errors when parsing the XML.

Echoing the string also doesn't work with <?.

I guess what is happening is that the string is getting parsed by the PHP engine for some reason. Escaping <? doesn't work.

I am assuming I am missing something basic. But the manual doesn't say anything about <? being parsed in strings.

Help?

Thanks

No comments posted yet

Your Answer:

Login to answer
263 Like 48 Dislike
Previous forums Next forums
Other forums

! = ''
In the following 'IF' statement if v_ompcat = PU for example then Oracle equates that 'IF' statement

IIS on 2003 anon access disabled issue
I have an IIS server that belongs to a domain, and anonymous access is turned off for all my sites.

Spaghetti Code
So.

I've pretty much reached the point where I have so many isset s on one page that I can't

MYSQL INSERT ID NOT WORKING
Code: $id = mysql_insert_id();
header("Location: ./?view=$id");
Why $id pulling blan

login page does not execute a else statement
I've created a login page using sessions.
When an incorrect user name or password is entered then

cPanel API
Hi Guys,

Need a little guidance. I'm trying to get my script to communicate with cPanel (or W

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

[newb] Image hosting help.
Hey there, I'm new to php, I know some basics and i can code PWN, I'm only 14 but I'm interested in

Adding to the next element in a multidimensional array
Hi, I'm trying to add a value to $node->field_spaces['nid'] where x is the next available spo

Beginners syntax and loop questions - help please!
Hi everyone,

I have some problems with php code. I'm currently in the middle of learning php,

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash