Doubts about php file_get_content timeout setting

one of my programs will initiate a http request to another project, using the file_get_content function. I need to make sure that the request is made, but I don"t need to return a result. Can I set the file_get_content timeout to 1 second? Because of the 3 seconds currently set, many slow requests

Mar.28,2021

file_get_contents () is specially used to obtain the file data stream. Either get it or report an error. If you just want to request, try curl . You can set the request duration


.

two ways

1. Temporarily modify ini configuration directly

ini_set('default_socket_timeout', 900);//

2. This function also has other parameters

$ctx = stream_context_create(array('http'=>
    array(
        'timeout' => 1200,//
    )
));

echo file_get_contents('http://example.com/', false, $ctx);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d143-2c370.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d143-2c370.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?