Skip to content
Advertisement

PHP – failed to open stream : redirection limit reached

My codes is here

<?php  echo (file_get_contents("http://123.com/video/latest.php")); ?>

Here is the error How can solve this

Warning: file_get_contents(http://123.com/video/latest.php): failed to open stream: Redirection limit reached, aborting in /home/123/public_html/index.php on line 340

Thank you.

Advertisement

Answer

Try to use this code, which won’t follow the redirects automatically:

$context = stream_context_create(
    array(
        'http' => array(
            'follow_location' => false
        )
    )
);

$html = file_get_contents('YOUR_URL', false, $context);

The other problem is that the URL you are trying to get content from returns a 404 error.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement