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

Notice Undefined index: reset/ Attempting to redirect, works, but get a notice
Full Header.php is:
Code: [Select]<?php
$reset= false;
$reset= strip_tags($_GET[&quo

delete comma
HI,

How to delete "," at the end of the string.
Code: $match = 2009/02/03/a2corr

Array becomes unset by itself?
Hi,

I have a bit of experience with PHP but not extensive. It seems I cannot store any items

Saas with SAP R/3
hi experts,

Is SaaS offer available in SAP? for SAP R/3? from where i can get the info a

foreach help.
Hello all,

First time I'm attempting to use a foreach statement and was just wondering if my

ScriptManager History and Opera Issue
I am having an issue in opera with the ScriptManager. I have a ScriptManager on a page with history

Simpler method of getting variables from mysql
Hi Guys,

I'm trying to streamline my CMS's code and as I was writing a new page it occured to

MS Access data into a html table
Hi everyone, I am quite a novice at php but I have created some helpful scripts that fetch data
f

rdns with php
I am trying to build a script that will show all of the different domains that are hosted on the sam

Getting a variable to work in function params
I have this fuction which is inside a class:

Code: public static function generateEmbedCode($

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