$url = "https://www.googleapis.com/youtube/v3/videos?id=".$row['video_id']."&part=contentDetails&key=[here is my Developer key]";
if(file_get_contents($url))
{
return true;
}
else
{
false;
}
When I check against a video id it show result like this if the video exists:
{
"kind": "youtube#videoListResponse",
"etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/pw80UEKFm5y728vQU5kjhUJTHGg\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/fBBgINoeGCSLK9f4shEUiy1MfeY\"",
"id": "tyV0npY-0g8",
"contentDetails": {
"duration": "PT17M36S",
"dimension": "2d",
"definition": "hd",
"caption": "false",
"licensedContent": true
}
}
]
}
If the video does not exist against the id
it shows total result 0 like this:
enter code here
{
"kind": "youtube#videoListResponse",
"etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/Rk41fm-2TD0VG1yv0-bkUvcBi9s\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": []
}
I'm storing the videoid in a database. Now if the video does not exist on youtube it generates a notification to the user: "your feature video is removed kindly update your video to newest upload video......."
Here is the screen shot also:
Kindly help me out.