Is there a way to use PHP to access files on a remote machine?

Joshua C

New member
Here is the setup: We have our website hosted through a hosting company, and my boss has asked me to write a web page that will give access, through the web, to some of the files on a local machine. Is there a way to do this without uploading all of the files onto the remote hosting machine?
 
fopen supports opening files using a web address but you have to enable allow_url_fopen in your php.ini. Once this is enabled you can use example.com or ftp.

Now, on the local machine that you want to access files on, you'll have to setup a web server, and not using microsoft IIS because there is a bug in the fopen protocol that closes the connection. And you'll probably have to have a static IP for that machine, or at the very least the router which that machine is behind. You'll also have to configure that router so that the incoming connection to that machine will be allowed, since for security it's not. After all that is done then you probably could set it up. But, that leaves security holes on your whole network. If those files are sensitive in nature then they are now exposed to the world. And a static IP is a lot more expensive from you ISP. I'd say that this is possible but not a very good idea.

You could potentially get away with not having a static IP as long as you write some file that checks the IP of the local machine and posts it to a public file that the other machine could read.

It's all very complicated and I'd be surprised if it was worth it.
 
Back
Top