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

BackButton Behaviour in AJAX
I have an ASPX Page AJAX Enabled!The page has a gridView and a DDL for filtering on it. The Gridview

Product categories for registration
Dear all,

We are going live with the Supplier registered next week. At standard, the 'sel

mysql_real_escape_string
Let me preface this that I am very much a PHP noob, but I have some SQL training (not necessarily My

Need help PLEASE
ok i have this warning showing up

Warning: in_array() [function.in-array]: Wrong datatype for

Help me with some material on Open Text Overview.
Hi Experts,
Please help me out with some material on Open Text. I have been supporting AP Workf

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

help with image text
Hi ...

see i need the text of the name and number to start in the center and always be in the

Remove letter from numeric textbox
I have a textbox that will search the employee database by entering in the employee ID and it will r

Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so

contact form - output to page and email
I have the following in my controller:

$message['name'] = htmlentities(strip_tags(trim($_POST

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