aşağıdakinin paylaşımlı sunucular dahil her yerde çalışması lazım.
headers = get_headers('http://gdata.youtube.com/feeds/api/videos/' . $youtubeid);
if (!strpos($headers[0], '200')) {
echo "video silinmis veya ulke kisitlamasi var";
return false;
}
curl ile denemek istersen (kodu çok önce pc ye kaydetmiştim nerde aldığımı hatırlamıyorum.
if(isset($_GET['id'])){
$check = "http://gdata.youtube.com/feeds/api/videos/".$_GET['id'];
$ch = curl_getinfo(); // create cURL handle (ch)
if (!$ch) {
die("Couldn't initialize a cURL handle");
}
// set some cURL options
$ret = curl_setopt($ch, CURLOPT_URL, $check);
$ret = curl_setopt($ch, CURLOPT_HEADER, 0);
$ret = curl_setopt($ch, CURLOPT_QUOTE, 0);
$ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// execute
$ret = curl_exec($ch);
if (empty($ret)) {
// some kind of an error happened
die(curl_error($ch));
curl_close($ch); // close cURL handler
} else {
$info = curl_getinfo($ch);
curl_close($ch); // close cURL handler
if (empty($info['http_code'])) {
die("No HTTP code was returned");
} else {
// echo results
if($info['http_code'] == 200){
echo "<br/>Video Exsist";}else{ echo "</br>Video Dose NOT Exsist"; }
}
}
}daha basitçe aşağıdaki şekilde xml çekip status kontrol edebilirsin.
$check = simplexml_load_file("http://gdata.youtube.com/feeds/api/videos/".$_GET['id']);