Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-28-2009, 08:19 AM Embed video problem
Tdm
Junior Talker

Posts: 1
Trades: 0
Hello

Ok...so I'm trying to embed the URL within the "location" tags of this XML file:

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>
That XML file is generated by "media.php?p=RAINBOW&z=SOCCER"

So, for my PHP script I tried this:

PHP Code:
<?php

  $title 
$_GET['p'];
  
$video $_GET['z'];

  
$url2='http://www.site.com/media.php?title='.$title.'&video='.$video;
  
$sxml simplexml_load_file($url2);

  list(
$node) = $sxml->xpath('/playlist/tracklist/track/location');
  
header('Location: '.$node);

?>
And I also tried this but neither worked because they gave blank pages:

PHP Code:
<?php

$title 
$_GET['p'];
$video $_GET['z'];


      
$url='http://www.site.com/media.php?title='.$title '&video='.$video ;
      
$string file_get_contents($url); 

      
$sxml = new SimpleXmlElement($string);
      
$node =  $sxml->playlist/trackList/track/location;
      
header('Location: '.$node);

?>
Help please?
Tdm is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-29-2009, 09:17 AM Re: Embed video problem
Super Talker

Posts: 139
Name: John Davis
Trades: 0
Have you tried to check the value of $node? I no, then do it.
__________________
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
»
Please login or register to view this content. Registration is FREE
for web developers
MapMaster is offline
Reply With Quote
View Public Profile Visit MapMaster's homepage!
 
Old 11-29-2009, 12:07 PM Re: Embed video problem
Skilled Talker

Posts: 79
Location: Devon, England
Trades: 0
Wouldn't you skip that whole $node line and just do the following?

header('Location: '.$sxml->location);

Oh sorry i didn't notice your second lot of code then.

Use the following to make sure the variable is grabbing the object correctly.

print_r($node);

and comment out the header location line. Then you will see if it's grabbed the object and the construction of the object.
__________________
Please add to my Talkupation if I was helpful. Thanks.


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Last edited by paaaaaaaaaa; 11-29-2009 at 12:24 PM..
paaaaaaaaaa is offline
Reply With Quote
View Public Profile Visit paaaaaaaaaa's homepage!
 
Reply     « Reply to Embed video problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31768 seconds with 12 queries