Jump to content

Recommended Posts

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-MCI8

That page will re-direct you to http://www.youtube.com/verify_age?next_url=/watch%3Fv%3D-oG6gb-MCI8

So 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
Link to comment
https://forums.phpfreaks.com/topic/30127-file_get_contents-help/
Share on other sites

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.php

that 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 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..
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.