Bug #74040 [Com]: file_get_contents not working anymore for adresses not on domain (timeout)

From: Date: Sun, 14 May 2017 18:44:18 +0000
Subject: Bug #74040 [Com]: file_get_contents not working anymore for adresses not on domain (timeout)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209112@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74040&edit=1

 ID:                 74040
 Comment by:         ganlvtech at qq dot com
 Reported by:        everdij at gmail dot com
 Summary:            file_get_contents not working anymore for adresses
                     not on domain (timeout)
 Status:             Feedback
 Type:               Bug
 Package:            *General Issues
 PHP Version:        7.1.1
 Block user comment: N
 Private report:     N

 New Comment:

I tried your test script and got the following warning.

SSL routines:ssl3_get_server_certificate:certificate verify failed

<?php
error_reporting(E_ALL);
$file_contents = "https://google.nl";
$contextOptions = array(
    'ssl' => array(
        'verify_peer' => false,
    )
);
$context = stream_context_create($contextOptions);
$body = file_get_contents($file_contents, 0, $context);
var_dump($body);
?>

If I set verify_peer to false, it works.


Previous Comments:
------------------------------------------------------------------------
[2017-02-04 16:08:42] rasmus@php.net

That's still not enough details. Your example works for us. Try it on a different server. This
is most likely a local network configuration issue. Like a firewall blocking outbound http requests.

------------------------------------------------------------------------
[2017-02-04 12:06:09] everdij at gmail dot com

Not working (gives time out)
$file_contents = "https://google.nl";
$body = file_get_contents($file_contents);
var_dump($body);

Not working gives timeout
$file_contents = "https://google.nl";
$body = file_get_contents($file_contents,null,null,null,null);
var_dump($body);

Works
$file_contents = "../local_file.txt";
$body = file_get_contents($file_contents);
var_dump($body);

Curl works! so looks like nothing to do with network setup

------------------------------------------------------------------------
[2017-02-03 15:07:44] requinix@php.net

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Make sure it's not a problem with your network configuration.

------------------------------------------------------------------------
[2017-02-03 15:00:10] everdij at gmail dot com

Description:
------------
file_get_contents not working anymore for adresses not on domain (timeout)



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74040&edit=1


Thread (8 messages)

« previous php.bugs (#209112) next »