I am just curious is it easy to give access on your website to users so that they can add videos from youtube? If yes can someone share php code how we can do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not easy for security reasons. You can easily get the embed code for a youtube vid and post it on your site, but you don’t want to allow users to just post vids without some type of validation, otherwise everyone will write scripts to redirect the page, etc.
I would get the URL and validate it thoroughly. Maybe just parse out the video ID (eg iUZOEBDN3a4) and then reconstruct the embed code yourself using php.
The embed code will be something like this:
<iframe width="420" height="345" src="http://www.youtube.com/embed/8I5JVl8u_Yw" frameborder="0" allowfullscreen></iframe>Then the if you want to share that with other users, say on a video sharing page, just save that code to an html file on your server, and load it to the view page using an include statement.