When I'm trying to use fsockopen I get operation timed out
errcode 60
error.
This is failing within the recaptcha class, however it also occurs for the following snippet:
<?php
$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
This error has started after I've switch my environment to use PHP 7.0.
The most interesting and funny thing is that it's working when I switch the URL to... www.stackoverflow.com
getting HTTP/1.1 200 OK
header.
Time out occurs for websites like: google.com
, yahoo.com
, facebook.com
.
Base extensions are installed, including:
- openssl,
- sockets,
- sessions
Exact PHP version:
# php -v
PHP 7.0.15 (cli) (built: Jan 24 2017 01:17:16) ( NTS
Did any of you guys had similar issue and could point me in the right direction?