Re: Why does file_get_contents take twice the time of default_socket_tieout when timeout occurs?
| From: | richard gray | Date: | Sat, 16 May 2015 09:54:50 +0000 |
| Subject: | Re: Why does file_get_contents take twice the time of default_socket_tieout when timeout occurs? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324899@lists.php.net to get a copy of this message | ||
On 31/03/2015 05:09, masahiro_honma wrote:
> I use file_get_contents to access to a web api.
> It's timeout is set by default_socket_timeout.
> When a web api took a long time to response, of course file_get_contents timed out.
> But It seemed strange. file_get_contents took more time than default_socket_timeout.
>
> For reproducing this problem,
> I prepared the program that took enough time to cause timeout and I tested file_get_contents.
> As a result, I found that file_get_contents takes twice the time of default_socket_tieout when
> timeout occurs.
> For example, when I set default_socket_timeout to 3 sec, file_get_contents takes 6 seconds to
> return the result.
>
> Why does file_get_contents take twice the time of default_socket_tieout when timeout occurs?
>
Hello Masahiro
I am sorry to respond so late to your message - did you resolve this
problem?
Rich