Forum Moderators: coopster

Message Too Old, No Replies

Outputting XML to PHP from one server to another

         

rjbearcan

2:02 am on Apr 28, 2006 (gmt 0)

10+ Year Member



I've been thinking about how to explain this so I will be as clear as possible.

I can (and have) use PHP to create properly formatted XML pages and what I want to do now is be able to include a XML file from one server to another using PHP. I don't want to parse the file, I want to keep the <markers></markers> and the rest of the XML tags.

I tried using the include statement but that only gives me
parse error, unexpected T_STRING in http://www.example.com/xmlfile.php on line 1.

Does anyone know how I can do this?

eelixduppy

4:23 am on Apr 28, 2006 (gmt 0)



Hello...

parse error, unexpected T_STRING in http://www.example.com/xmlfile.php on line 1

It seems like this error that you are receiving is due to an error regarding the placement and/or use of quotation marks and/or apostrophies. Make sure everything is properly written on line 1.

Sorry for the lack of help.
Good luck

eelix

rjbearcan

4:51 am on Apr 28, 2006 (gmt 0)

10+ Year Member



Well that's what I thought too but for example say I use Yahoo's Weather XML output at
[xml.weather.yahoo.com...] that's the output I want, but say I try to include this URL by:
<? include "http://xml.weather.yahoo.com/forecastrss?p=12345";?>

I get the parse error. If I use single quotes instead, I still get the error, I don't see where the error is.

eelixduppy

1:04 pm on Apr 28, 2006 (gmt 0)



Hi

Instead of using include(), try using fopen().

Examples on how to use remote files are here [us2.php.net...]

Good luck :)

eelix

rjbearcan

6:03 am on Apr 29, 2006 (gmt 0)

10+ Year Member



Ok, I've been making progress but there is still one minor problem:
I use file_get_contents with the URL, ie: [xml.weather.yahoo.com...] then use htmlspecialchars to output the xml. Well, all the tags are there, but it's just one big blob. It's not being displayed as a properly formatted xml page.

Any ideas?