Я пытаюсь использовать oEmbed, чтобы проверить, существует ли видео Youtube или Vimeo. Мой код отлично работает с Youtube, но не работает с Vimeo, даже если я следую официальной документации Vimeo для oEmbed. и приведенный там пример. Почему мой код не работает для Vimeo? Я получаю ответ сервера 200 для Youtube, но ответ сервера 0 для Vimeo. Мой код:
<?php
//Problematic case: I get 0 as a server reponse
$cURL = curl_init("https://vimeo.com/api/oembed.json?url=https%3A//vimeo.com/76979871");
// Youtube case - works fine: server response = 200
// $cURL = curl_init("http://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=ebXbLfLACGM");
// Set option 1: return the result as a string
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
// Set option 2: Follow any redirect
curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, true);
// Execute the query
$cURLresult = curl_exec($cURL);
// Get the HTTP response code
$response = curl_getinfo($cURL, CURLINFO_HTTP_CODE);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Server response</title>
</head>
<body>
<h1><?php print "Server response: " . $response; ?></h1>
</body>
</html>
Server response: 200
. Возможно, это была временная заминка? - person johnh10   schedule 14.11.2015