|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81448 file_get_contents cuts off incoming HTTP data
Submitted: 2021-09-16 15:57 UTC Modified: 2021-09-16 21:18 UTC
From: gajowy at agzeta dot pl Assigned:
Status: Open Package: HTTP related
PHP Version: 8.0.10 OS: Windows 10 64-bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
26 + 29 = ?
Subscribe to this entry?

 [2021-09-16 15:57 UTC] gajowy at agzeta dot pl
file_get_contents function can't get data from NASA servers. The server returns code 200 OK and data starts to be transmitted, however are cut off after some time (~120 seconds). It happens that data are transmitted correctly and the whole transmission takes app. 2 seconds in this case. 
The same request is working without any problem if curl is used.

It was tested on PHP 8.0.10 and 7.4.20 on 3 various (independend) networks.

Test script:
// ensure, that openssl extension is loaded
if( !extension_loaded('openssl') )
	exit("Please enable openssl extension in PHP.ini!\n");


printf("%d bytes downloaded in %.3f seconds\n",strlen($ret),microtime(TRUE)-$m0);



Expected result:
app. 480.000 bytes response is get. The output should end with a line with asterisks.

Actual result:
The output is cut of in various places, usually between 10k-200k of data.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-16 15:58 UTC] gajowy at agzeta dot pl
The NASA server is nginx.
 [2021-09-16 21:18 UTC]
I can confirm that there is an issue (PHP-7.4 on Windows).
Increasing default_socket_timeout doesn't help.
 [2023-01-09 09:47 UTC] fariba dot shami326 at gmail dot com
That's great. I was impressed by your writing. I am happy to see such a topic. Please come to my blog and read it.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Nov 29 16:01:27 2023 UTC