IHTMLProx = "text">
I am using fgets () to write the file content in the local file created through the line to read the remote file line and created via tempnam (). However, downloads of very large files (several hundred MB) are failing. Either way can I reuse the script to catch errors?
Because the download is only part of a larger overall process, I want to handle downloads and deal with errors instead of going into wget or any other process in PHP scripts.
This is the script I am using now:
$ tempfile = fopen ($ infilename, 'w'); $ Handle = @fopen ("https: //". $ Server. ".domain.com / file / path.pl?keyID =". $ KeyID. "& Amp; Format =". $ Format. "And zipped = True "," r "); $ First line = ''; If ($ handle) {while ($ (handle $ FIFF) {$ buffer = fgets (handles, 4096); if ($ first line == '') $ first line = $ buffer; filitt ($ tempfile , $ Buffer);} Fclose ($ handle); fclose ($ tempfile); return first line;} and throw new exception ('unable to open remote file.');}
I can say that you are looking for (especially STREAM_NOTIFY_FAILURE)
& amp; STREAM_NOTIFY_COMPLETED
constant)
Comments
Post a Comment