note 94865 added to function.stream-set-timeout
| From: | mildlydullatterriblycleverdotcom at osu1 dot php dot net | Date: | Mon, 30 Nov 2009 01:53:23 +0000 |
| Subject: | note 94865 added to function.stream-set-timeout | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163387@lists.php.net to get a copy of this message | ||
I didn't have much luck with the suggestions below (although I likely applied them wrong).
Instead, I used stream_context_create() and set an http option for timeout. I fed that context into
file_get_contents() and voila!
To my desperate friend below: the https transport can also use the http stream context options. I
haven't verified this works as I don't have a slow responding ssl to test on. But if you
are still stressing, give the below a shot (you may need to modify a bit...)
$timeout = 5*60;
$options = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n",
'timeout' => $timeout
)
);
$context = stream_context_create($options);
$contents = file_get_contents($source, false, $context);
Yes...that is a 5 minute timeout.
----
Server IP: 64.71.164.2
Probable Submitter: 24.23.238.12
----
Manual Page -- http://www.php.net/manual/en/function.stream-set-timeout.php
Edit -- https://master.php.net/note/edit/94865
Del: integrated -- https://master.php.net/note/delete/94865/integrated
Del: useless -- https://master.php.net/note/delete/94865/useless
Del: bad code -- https://master.php.net/note/delete/94865/bad+code
Del: spam -- https://master.php.net/note/delete/94865/spam
Del: non-english -- https://master.php.net/note/delete/94865/non-english
Del: in docs -- https://master.php.net/note/delete/94865/in+docs
Del: other reasons-- https://master.php.net/note/delete/94865
Reject -- https://master.php.net/note/reject/94865
Search -- https://master.php.net/manage/user-notes.php