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
How to display random record from table?
I have the following code:
Code: <?php
$display_block .= "<input type=
DELETE FROM not working deletes wrong row
Hello
I have the following code which i found but it doesnt work properly.. it comes up with
PHP Cannot redeclare class
I have 6 files, and two of them do not seem to want to play well. I keep getting a "Cannot rede
Variable Clash
In the past I've had variables clash. For example:
Code: <?php
$c = 5;
$ca
Header redirect
Hello ive got a problem ive got form with its action set to itself.
Code: <form id="f
Basic Question Regarding PHP Includes
Hi
Just starting out with PHP.
Working on a site that uses some basic includes, these
FTP Programs
Here is a list of commonly suggested FTP Programs to use:
FileZilla
SmartFTP
CuteFTP
how to read and write into a word document using php...?
hi,
I need,reading and writting into a word document using php.
Thank u inadva
Accessing element of object array
Hello
My object looks like this:
Array ( [0] => User Object ( [id] =>
Linking with Foreign Keys
I have been getting an erro when I try and link:
create table Faculty_Specialty (I_Name v