mE.e26 - HTTP-Auth File Retrieval

I made this function when I wanted to use an API which required HTTP Authentication. The script uses a cache file as not to overwhelm the server.

How?

The function checks to see if a cache exists and if the cache was updated recently. If not then it will download the file. This function was made to be used in conjunction with other scripts. A typical call to this function is included before the function. You could then use xslt to transform the output of the function into html to go on a web-page.

Requirements

A php install with --with-curl=[DIR]. You will need a text file to act as the cache, this file should have the appropriate permissions to be written in to.

The Code

Please find the code here: get-remote-file.php

back

Back to e26.co.uk