I'm working on a personal project, which is a copy of netflix but with videos and playlist from a youtube channel.
I have multiple categories, and I'm passing a different query based on each category.
I am using the Youtube V3 API to retrieve the information I need, but I have a problem.
I have a 403 forbidden error, which appears randomly.Imagine that I have 3 categories. I'm going to load the web page and I'm going to have the error on category 2 while categories 1 and 3 are displayed normally.I refresh my web page, and it is now category 1 that has the error, while categories 2 and 3 are displayed normally.
Has anyone ever had this kind of problem?
Here is the full error:
Warning : D:\laragon\www\index.php on line 61 file_get_contents(https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=THE_CHANNEL_ID&maxResults=8&order=viewCount&type=video&key=MY_API_KEY): Failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in
THE_CHANNEL_ID and MY_API_KEY are well informed in my code.