Jump to content

URL in XML file


Graxeon

Recommended Posts

I'm trying to get to "site.com/soccervideo.flv" within this XML file:

 

<?xml version="1.0" encoding="utf-8"?>
<playerconfig version="1.1">
<playlists>
	<playlist id="">
		<items>
			<item id="soccervideo">
				<videos>
					<video>
						<streams>
							<stream>
								<locations>
									<location seeking="yes">
									     http://site.com/soccervideo.flv
									</location>
								</locations>
							</stream>
						</streams>
					</video>
				</videos>
			</item>
		</items>
	</playlist>
</playlists>
</playerconfig>

 

I tried this code but I get a blank page:

 

<?php

$url = $_GET['url'];

$sxml = new SimpleXMLElement('http://site.com/embed/' .$url, NULL, TRUE);
header("Location: {$sxml->playerconfig->playlists->playlist->items->videos->video->streams->stream->locations->location}");
?>

 

Help please? I'm not sure if this is the correct method of going about it.

Link to comment
https://forums.phpfreaks.com/topic/184435-url-in-xml-file/
Share on other sites

This should work:

$sxml->playlists->playlist->items->item->videos->video->streams->stream->locations->location

If there is more than one node in your xml, you can use array notation:

$sxml->playlists[0]->playlist[0]->items[0]->item[0]->videos[0]->video[0]->streams[0]->stream[0]->locations[0]->location[0]

 

Link to comment
https://forums.phpfreaks.com/topic/184435-url-in-xml-file/#findComment-973681
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.