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:
Did you know?Explore Trending and Topic pages for more stories like 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&title=SOCCER</info>
<meta rel="type">m4v</meta>
<image>images.php?title=SOCCER&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
19
Other forums
Join Query Help
Hi all,
I am having problems with the below code, which we shall call 'my first join query'!
Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and ex
undefined offset help
Hi All,
I kept getting undefined offset PHP notice for a simple for loop. For eg
$va = arr
How to update this array?
I am saving a string that looks this: username1, username2, username3...
into a single cell in a
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
Problem!
I have another problem, when i run this code i get this error "Parse error: syntax error, unexp
Adding post count
How would I make it so everytime someone clicks submit on my form, their row in the database for the
session checking in page load
hai all
I have a web site is www.Mryas.com in this my login page is Page1.aspx its co
First root of a number
Hi,
I can't find any function in php to give me the first root of a number.
Is there any
Wrong Info sent Using $get in form
Hi i have this code that i tried to make to send some info from one page to aother with lots of ppls