Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-06-2008, 07:15 PM   #1 (permalink)
chillspike
Junior Member
 
Join Date: Apr 2008
Posts: 4
Question fetch url's in php video scripts???

Can anyone shed some light on how working fetch url's for video scripts are obtained? I've been trying to figure it out myself and find some consistancy in the process but it just seems pretty random to me.

Below is the exampl code file for a page that pulls videos from youtube and embeds them in a video script...It uses a fetch url (highlighted in red)...I don't know how that url was obtained ...And even in some case where I can...there doesn't seem to be any logical way to find the fetch url for other video sites...Can anyone explain this to me to make it easier to find these url's for different video sites and add them to a script..? Thank you...

Code:
<?php function yt($ytsearch) { global $ytcurrenttag; global $ytvids; global $ytid; $ytvids = array(); $ytid=0; function ytinsidethetag($ytparser, $ytdata){ global $ytcurrenttag; global $ytvids; global $ytid; if(!strcmp(strtolower($ytcurrenttag),"title")) { $ytvids[$ytid]['type'] = "yt"; $ytvids[$ytid]['title']=$ytdata; $ytvids[$ytid]['title'][0] = ucwords($ytvids[$ytid]['title'][0]); } } function ytopentag($ytparser, $ytdata, $ytattr=''){ global $ytcurrenttag; $ytcurrenttag = $ytdata; global $ytvids; global $ytid; if(!strcmp(strtolower($ytcurrenttag),"media:player")) { $ytvids[$ytid]['link']=str_replace("watch?v=","v/",$ytattr['URL']); $ytvids[$ytid]['thumb']=str_replace("http://www.youtube.com/v/","http://img.youtube.com/vi/",$ytvids[$ytid]['link']); $ytvids[$ytid]['thumb'].="/2.jpg"; } } function ytclosetag($ytparser, $ytdata){ global $ytid; if(!strcmp(strtolower($ytdata),"entry")) $ytid++; } $ytxml_parser = xml_parser_create(); xml_set_element_handler($ytxml_parser, "ytopentag", "ytclosetag"); xml_set_character_data_handler($ytxml_parser, "ytinsidethetag"); include_once("fetch.php"); $ytdata = fetchrss("http://gdata.youtube.com/feeds/videos?vq=$ytsearch&start-index=1&max-results=50"); if(!(xml_parse($ytxml_parser, $ytdata))) die("Error on line " . xml_get_current_line_number($ytxml_parser)); xml_parser_free($ytxml_parser); return $ytvids; } ?>
__________________
chillspike is offline   Reply With Quote
Sponsored Links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 08:27 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums