最近最近在学习些PoC,发现大部分PoC都会有这样一句ini_set('default_socket_timeout', 5)
\<\?php
$url =
'http://www.cnblogs.com/Zjmainstay/archive/2012/03/08/PHP_FUN
CTION_file_get_contents.html';
ini_set('default_socket_timeout', 3);
if($data = file_get_contents($url)) {
}else {
}
\?\>


Test script:
---------------
php -r 'ini_set("default_socket_timeout", -1); echo file_get_contents("http://www.google.com");'
Expected result:
----------------
print the html of google page.
Actual result:
--------------
PHP Warning: file_get_contents(http://www.google.com): failed to open stream:
Operation now in progress in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
PHP 2. file_get_contents() Command line code:1