Home >Backend Development >PHP Tutorial >file_get_contents timeout setting

file_get_contents timeout setting

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-08 09:23:321777browse

file_get_contents timeout setting

// Create the stream context

$context = stream_context_create(array(

) 'http' => ; array(

'timeout' => 3000 //Timeout, in seconds

)

));

// Fetch the URL's contents

$ contents = file_get_contents('http://sample.com', 0, $context);

Reference: http://www.acwind.net/blog/archives/1269

The above introduces the file_get_contents timeout setting, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn