I am trying to read a large (32M remote file with fread and then write it to our server where we can parse it. It is a fixed-width text file with inventory information for our shopping cart. When I run the script though it will only read a portion of the file. The amount it reads seems to vary each day (new file) but is the same every time on the same file. Today it will read 2562 bytes of the file, yesterday was 3750 bytes. Anyway, any ideas on what is going on? also, the filesize() function in the fread returns an error so I have just been putting in some moderately large value like 50000 or something for testing. I have also set the timeout value on the script to 60, 600, 0 to see if that was the problem.
(i've replaced some of the sensitive info with * but the URL is valid and will output the full file to a browser)
set_time_limit (0);
$loc = "https://****.unitedstationers.com/access/services.asp?txtServer=****&txtUID=*****&txtPWD=****cmdSubmit=GET&srcFile=INVPOS&srcFolder=*****&txtType=ASCII&RequestType=*";
$fp = fopen($loc, "r");
$fstring = fread($fp, 500000);
$nfp = fopen('testwrite.txt', "w");
fwrite($nfp, $fstring);