|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-09-16 15:58 UTC] gajowy at agzeta dot pl
[2021-09-16 21:18 UTC] cmb@php.net
[2023-01-09 09:47 UTC] fariba dot shami326 at gmail dot com
[2024-06-12 10:03 UTC] blanca236tyndall at outlook dot com
[2024-06-22 06:48 UTC] thomas642daniel at outlook dot com
[2024-07-05 06:14 UTC] krina234pestro at outlook dot com
[2024-07-08 04:52 UTC] krina234pestro at outlook dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
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.