Youtube api blocks cloudflare (?)

The YouTube API is blocking Cloudflare. I tested it from different hosts not connected to Cloudflare, and it only blocks hosts using Cloudflare.


$videojson = file_get_contents("$videojsonurl");
$jvideos = json_decode($videojson);
$vchannelurl= $jvideos->author_url;
if ($vchannelurl == "") {
echo "warning"; }
else echo "$vchannelurl";

It works on different hosts but doesn’t work on Cloudflare only.

The response I receive:
[25-Oct-2023 09:13:25 UTC] PHP Warning: file_get_contents(;url= Failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
in /home/test1.php on line 3
[25-Oct-2023 09:13:25 UTC] PHP Warning: Attempt to read property “author_url” on null in /home/test1.php on line 5

Are you aware of this situation, and do you have a solution?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.