Load file in PHP


Posted on 16th Feb 2014 07:03 pm by admin

I have 2 files. The first is a PHP generated XML file that's dependent by 2 inputs. The second is a PHP file that grabs the content of the XML file.

So I have this:

site.com/xml.php?p=RAINBOW&z=SOCCER
Code: <playlist version="1">

<trackList>

<track>
<title>SOCCER - RAINBOW</title>
<location>http://www.site.com/soccer-rainbow.m4v</location>
<duration>23:27</duration>
<info>http://www.site.com/info.php?video=RAINBOW&amp;title=SOCCER</info>
<meta rel="type">m4v</meta>
<image>images.php?title=SOCCER&amp;video=RAINBOW</image>
</track>

<track>
<title>SOCCER</title>
<location/>
<meta rel="type"/>
</track>
</trackList>
</playlist>
I want to grab the contents of the "location" tags.

So, I have this now:

media.php?p=RAINBOW&z=SOCCER
Code: $title = $_GET['p'];
$video = $_GET['z'];

$myXML = 'www.site.com/xml.php?p=' .$title. '&z='.$video;

$sxml = simplexml_load_string($myXML);
list($node) = $sxml->xpath('/playlist/trackList/track/location');
header("Location: $node");
But I get the error "Fatal error: Call to a member function xpath() on a non-object on line 9".

What variables did I mess up? Can someone help me fix it, please?

No comments posted yet

Your Answer:

Login to answer
83 Like 19 Dislike
Previous forums Next forums
Other forums

Collecting AOL Search Terms
I am attempting to collect AOL search terms. I know the code is correct (it works for google, bing,

get url?
how do i get the url of the page i'm currently on, on my website.. i think its get header.. how do i

Google Wave
So... has anyone used it yet? Is it any good?

http://wave.google.com/help/wave/about.html#vid

Amatuer requiring assistance
Beginner and amateur in need of assistance

My Site - (Spare Parts for Domestic Appliances)

Undefined variable when using $_SERVER['PHP_SELF']
Hi guyz, please suggest me something...
On first.php I have one input field NAME, and on posting

PHP and MySQL on intranet?
Is it possible to use both these on an intranet network?

using explode() to fill in checkboxes
Hi

I have a field stored in a table that contains regions in the UK separated by commas. Ther

Need help in log in and log out?
hi there all of u. i have recently created a site for someone. i have placed log in and log out and

query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:

Code: [Select]$query

Question about the upload of large files
Hi there,

I have a question about the upload of large files, like videos (files generally abo

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