Bug #81448 [Opn]: file_get_contents cuts off incoming HTTP data

From: Date: Thu, 16 Sep 2021 15:58:54 +0000
Subject: Bug #81448 [Opn]: file_get_contents cuts off incoming HTTP data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236651@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81448&edit=1 ID: 81448 User updated by: gajowy at agzeta dot pl Reported by: gajowy at agzeta dot pl Summary: file_get_contents cuts off incoming HTTP data Status: Open Type: Bug Package: HTTP related Operating System: Windows 10 64-bit PHP Version: 8.0.10 Block user comment: N Private report: N New Comment: The NASA server is nginx. Previous Comments: ------------------------------------------------------------------------ [2021-09-16 15:57:16] gajowy at agzeta dot pl Description: ------------ 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: --------------- <?php // ensure, that openssl extension is loaded if( !extension_loaded('openssl') ) exit("Please enable openssl extension in PHP.ini!\n"); $url="https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND='00004%3B'&MAKE_EPHEM=YES&TABLE_TYPE=OBSERVER&CENTER='K80'&START_TIME=%272021-09-15+10%3A48%3A24+UT%27&STOP_TIME=%272021-09-16+10%3A48%3A24%27&STEP_SIZE=1m&REF_SYSTEM=J2000&QUANTITIES='1,3,4,19,20,21,23,25,8,9,33,38,43'&ANG_FORMAT=DEG&RANGE_UNITS=AU&APPARENT=REFRACTED&TIME_DIGITS=FRACSEC&EXTRA_PREC=YES&CSV_FORMAT=YES"; print("Running...\n"); $m0=microtime(TRUE); $ret=file_get_contents($url); printf("%d bytes downloaded in %.3f seconds\n",strlen($ret),microtime(TRUE)-$m0); file_put_contents('query.txt',$url); file_put_contents('header.txt',print_r($http_response_header,TRUE)); file_put_contents('document.txt',$ret); ?> 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81448&edit=1

« previous php.bugs (#236651) next »