I wouldn't mind using some not-only-PHP solutions. I have a good experience with Flash + PHP for instance. The closer I could get to solve this was:
Make a Flash interface that first calls de PHP script which starts the transfer from server to server.
Once the transfer has been started, make the Flash movie periodically call another PHP file, which checks if the destination file exists.
Obviously, while the transfer is going on the file won't exist yet, and it will return 'false'. So I can tell the user to keep waiting. Then, if the transfer is completed at some point, the PHP script will return 'true' when it checks for the existence of the destination file, and then the Flash movie would tell the user that it's done.
This doesn't give the user any idea of the progress, but at least it does indicate when it's finished, which is more than what the PHP script does.
However, there's a problem with this too:
If the transfer fails at the very beginning, the PHP file will return an error message but the file will be created (being 0 bytes in size), which would mistake the user by telling him/her that it's done. I could code the PHP in such a way that it only creates the file if the download succeeds, but then, as it's never created, the user would be told to wait forever.
So basically I need to 'catch' those errors that the PHP file throws so that I could inform the user of the failure. My new question is: is there ANY way to do this?
As far as I know, Flash can only catch variables from the outside if they're sent in the form:
&variable1=value1&variable2=value2&
But PHP returns errors in the form:
Warning: file_get_contents(http://www ... in /mounted-storage/home94b/sub008/sc47438-UGYH/ ... on line 11
Can you think of any way to catch the error messages that the PHP file returns, and add something like this at the beginning of the string? :
&errors=
then send them to the flash movie?
Then I would search for different error strings in the "errors" variable and inform the user accordingly.
But how could I do that? Maybe running the PHP from another PHP? Like:
$errors=file_get_contents("original_php_script.php");
echo ("&errors=".$errors);
Is this possible? Or would this return the actual contents of the PHP file itself, rather than run it?
Any help would me much appreciated...
Thanks!