In my project user will upload a video by pasting a URL from another site. I tried embedly but doesn’t work properly since it gives embedded code for a particular site, YouTube etc. I want to do exactly like this site http://www.myvidster.com/. I tried using cURL code for this:-
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $video_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_VERBOSE, true); // Display communication with server
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json_reply = curl_exec($ch);
curl_close($ch);
and code with file_get_contents is:
$video_url = $_POST['video_url'];
$html = file_get_contents($video_url,true);
But using curl also I got HTML part of some sites only. I am trying for 1 week but still no result. Is it possible to get an embedded code for video from every site? Or I am doing anything wrong?
you should be looking into the oembed standard
this protocol allows you to receive the embed code from multiple video sites that support it, in a standard unified way.
Click the link to see a list of sites that implement oembed
http://oembed.com/#section7
For the other websites that don’t support this standard you can usually fetch the embed code through the open graph protocol (meta og:…) or write html parsing rules for each site to extract the embed