I'd like to expand on my code to try to solve another problem if I may, but I'm having a problem figuring out how to do it(or if it can even be done).
I have read that the YT videos that disable embedding use a statement in the header to keep it from being embeddable by 3rd parties. I currently ask the submitter to check to see if it can be embedded by opening up a new window with the embed attempt. I'd really like to have the script handle this , but am having a problem finding any mention of "embed" in the returned code.
It seems that the magic I'm looking for is "X-Frame-Options" being set to "SameOrigin" but I can't find this in any returned code in my curl test:
<?php
function urlStatus($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
return $info;
}
// $url = 'https://www.youtube.com/watch?v=43129y2paLs';
// $url = 'http://gdata.youtube.com/feeds/api/videos/43129y2paLs';
$url = 'https://www.youtube.com/embed/43129y2paLs';
$urlafter = urlStatus($url);
print_r($urlafter);
I've tried the URL that you use to view at Youtube, the gdata url for feed purposes and the embed URL that is used in the iFrame. I can't get it to show up anywhere.
I'm testing with a video that is set to disallow embedding: https://www.youtube.com/watch?v=43129y2paLs
Could someone tell me if I can get this value via CURL?
Thanks!