mynamesleo Posted December 10, 2006 Share Posted December 10, 2006 Hi guys hope you can help me out again.I am using file_get_contents to get a page then sort through the source to get the information needed, works fine.The pages I am going through are youtube videos (to get the video id making it possible to download the video, as there is no download option). Problem is some videos are flagged and you must confirm you're age to see it, so the page is redirected to a page where you confirm this, for example:http://www.youtube.com/watch?v=-oG6gb-MCI8That page will re-direct you to http://www.youtube.com/verify_age?next_url=/watch%3Fv%3D-oG6gb-MCI8So the source file_get_contents is grabbing is the verify page, which is no good to me.Is there a way to stop it from redirecting and just get the first links source?Thanks Quote Link to comment https://forums.phpfreaks.com/topic/30127-file_get_contents-help/ Share on other sites More sharing options...
fert Posted December 10, 2006 Share Posted December 10, 2006 The only way i know how to do it is to use CURL to send valid cookies to the site and then access the video. Quote Link to comment https://forums.phpfreaks.com/topic/30127-file_get_contents-help/#findComment-138564 Share on other sites More sharing options...
.josh Posted December 10, 2006 Share Posted December 10, 2006 please make some kind of effort to name your topics appropriately, not just "help please." Quote Link to comment https://forums.phpfreaks.com/topic/30127-file_get_contents-help/#findComment-138567 Share on other sites More sharing options...
mynamesleo Posted December 12, 2006 Author Share Posted December 12, 2006 Sorry about the title.Ok I have tried curl but its over my head at the moment, does anybody know how this sites doing it:http://javimoya.com/blog/youtube_en.phpthat site is able to download a video from youtube which i understand, but if the video is like this one:it re-directs to a "sign up or register page" , the information needed is on the actual page (http://www.youtube.com/watch?v=-oG6gb-MCI8) - so how does this site get the info from that page?? is it usng curl? it doesnt place any youtube cookies so..? :o confused :o Quote Link to comment https://forums.phpfreaks.com/topic/30127-file_get_contents-help/#findComment-139927 Share on other sites More sharing options...
hitman6003 Posted December 13, 2006 Share Posted December 13, 2006 They are probably using a youtube api of some sort...http://www.youtube.com/dev Quote Link to comment https://forums.phpfreaks.com/topic/30127-file_get_contents-help/#findComment-140069 Share on other sites More sharing options...
mynamesleo Posted December 13, 2006 Author Share Posted December 13, 2006 [quote author=hitman6003 link=topic=118071.msg483733#msg483733 date=1165975563]They are probably using a youtube api of some sort...http://www.youtube.com/dev[/quote]no already checked that out. the information needed to download the video is on the actual video page, but it re-directs.. so i dont see how that program gets it.. Quote Link to comment https://forums.phpfreaks.com/topic/30127-file_get_contents-help/#findComment-140366 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.