Graxeon Posted December 1, 2008 Share Posted December 1, 2008 If you know of a script or a tutorial that explains this (in TOTAL NEWBIE form), then please give me the link. I have checked this tutorial but can't make sense of it: http://www.phpfreaks.com/tutorial/handling-xml-data/page2 Ok so... I would like to retrieve the url in this line: <media:content url="http://content.movies.myspace.com/0020238/44/22/2023812244.flv" type="video/x-flv" medium="video" duration="221"/> That line comes from this document: http://mediaservices.myspace.com/services/rss.ashx?type=video&mediaID=8255294 I would like for that URL to be copied and brought back to the user in a form of redirecting. So say I have this: msflv.php User asks to get the URL of the video with the id of "8255294" by going to: msflv.php?id=8255294 msflv.php?id=8255294 then goes to "http://mediaservices.myspace.com/services/rss.ashx?type=video&mediaID=8255294" and retrieves the URL msflv.php?id=8255294 then redirects the user to "http://content.movies.myspace.com/0020238/44/22/2023812244.flv" I do have this script (it's where I got the idea from) but cannot figure out how to alter it: <?php $url='http://mediaservices.myspace.com/services/rss.ashx?type=video&mediaID='.$_GET['video'];; if ($details = file("$url")) { foreach($details as $value) { if(preg_match('/url=\"(.*?)\"/', $value, $match)) { $myspace = $match[1]; } } header("Location: $myspace"); } ?> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted December 1, 2008 Share Posted December 1, 2008 <?php $url='http://mediaservices.myspace.com/services/rss.ashx?type=video&mediaID='.$_GET['video']; $sxml = simplexml_load_file($url); list($node) = $sxml->xpath('/rss/channel/item/media:content'); header('Location: '.$node['url']); ?> Quote Link to comment Share on other sites More sharing options...
Graxeon Posted December 1, 2008 Author Share Posted December 1, 2008 Answered, TYVM! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.