File_get_contents does not work for some pages


I have the problem that I cannot access a few pages. This is the warning code I get:

Warning: file_get_contents( failed to open stream: HTTP request failed! HTTP/1.0 429 Too Many Requests
in /home/vol15_5/ on line 19

Other sites work fine. The code I used is the following: (

$opts = stream_context_create(array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false

echo file_get_contents("", false, $opts);
echo file_get_contents("", false, $opts);
echo file_get_contents("", false, $opts);


Why are you trying to get file context of Youtube?

I want to extract the video description.

Does that matter?

Yes it does, you better use cUrl




I don’t care.

1 Like

The 429 status code means that something (probably YouTube) is saying that too many requests are coming from the IP address. It could be that your site, or another site on the server, is trying to load too much data from YouTube, and YouTube says it’s enough.

This is not really something that can be fixed with any kind of scripting or library.

Are you trying to access YouTube specifically from your site a lot?

1 Like

if YT blocks you due to too many requests then you need to use their YT API

1 Like

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