I'm trying to verify if a youtube video (with the id_video) is valid/exist , using the youtube api V3. That's what i do (y2oy7b4SFgE is the id of the video i test):
$file_headers = @get_headers('https://www.googleapis.com/youtube/v3/videos?part=id&id=y2oy7b4SFgE&key=ma_clé_api_publique');
//exit(var_dump($file_headers));
if ($file_headers[0] == 'HTTP/1.0 200 OK') {
$resultat = $file_headers[0].'Goood'
} else {
$resultat = $file_headers[0].'PasGoood'
}
But i have a "code": 403, "message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
Its working well when no referer. But when i put one, i tried with the name of my website or with the ip of my vps server, each time it doesn'work.