[Sussex] Getting files from a remote web server in a PHP script

Steve Dobson steve at dobson.org
Sat Oct 22 19:49:46 UTC 2005


Mark

On Sat, Oct 22, 2005 at 08:04:53PM +0100, Mark Harrison (Groups) wrote:
> On Sat, 2005-10-22 at 19:46 +0100, Steve Dobson wrote:
> > I need to write a little script to fetch HTML files from a remote
> > web server from within a PHP script.  Now I could use system()
> > to call wget and do it that way.
> > 
> > But I was wondering is there a better way (more direct) of getting 
> > the remote data?
> 
> fopen supports http as if it were a file system, so you can do stuff
> like:
> 
> $myfile = fopen("http://www.remoteserver.com/mydirectory/myfile", "r");
> 
> However, there's a server-wide boolean called allow_url_fopen that needs
> to be set to true for this to work.

Hany, many thanks.  This was just what I was after.

Steve

-- 
Pause for storage relocation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20051022/64ea9795/attachment.pgp 


More information about the Sussex mailing list