what is the most reliable method to get a file fro

2019-09-05 12:12发布

I am writing a PHP script that will be installed on a users server. I want to pull a file from MY remote server (a zip file) and write it to the local server that the script is running on.

I can do it just fine use file_get_contents and also using Snoopy.

However, the issue is that my script will be distributed to lots of people who will have a variety of servers. They will range from freebie webspace to their own dedicated rack with everything in between :) I can't be certain that the correct options will be enabled for file_get_contents to work and I know that, if certain options are disabled, it will be unlikely that the user will be able to get them enabled.

So, I am thinking that, pretty much, the only thing I can guarantee is the they will have PHP 4 + what is the best way to pull the remote file - IE: Which way has the best chance of working on such a large range of webservers :

  1. file_get_contents
  2. Snoopy (using fetch)
  3. fsockopen

Any ideas or comments would be MUCH appreciated :)

标签: php file
0条回答
登录 后发表回答