0

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 :)

SiUK
  • 1
  • What about the curl implementation in PHP? – madflow Aug 13 '12 at 19:14
  • 1
    Send a courier with a thumb drive. Most reliable, but not quite as fast as one would like. – Matt Aug 13 '12 at 19:20
  • Matt : LOL Like it! Phill Cross & madflow - I thought of CURL but can't be sure that it will be enabled - Some of these servers are going to be free hosting space - Some will be low end (IE: $5 per month HostGator "unlimited" type hosting) - Some will be top end stuff with configurable options - Thing is, I need to try and cover the lowest common denominator where possible. – SiUK Aug 13 '12 at 19:25
  • If it was me designing the transfer system, I'd personally find as many ways to transfer the files across and order them by ease of use / efficiency. I'd then attempt to perform them in that order. If the first one (for example cUrl) fails, move onto the next process (ie FTP / etc). – Phil Cross Aug 13 '12 at 19:33
  • I was kinda thinking the same thing to be honest - And the last resort would, of course, be FTP. What I would like to know though is what the most likely order of failure is - IE: What would be the mos probable order to attempt things? – SiUK Aug 13 '12 at 21:22

0 Answers0