Hello,
PHP 5 comes with built-in class called cURL,which is an extension for command line utility cURL that is "wget on steroids".It supports .htaccess authentication.
Suppose that your URL of protected directory is:
http://192.168.1.1/cgi-bin/test.cgi'username:
3xtr3m3d
password: secretFrom linux comand line, to get file test.cgi you would write:
curl http://3xtr3m3d:secret@192.168.1.1./cgi-bin/test.cgi > test.cgi
From php code,this is the code that will read the file from remote, HTTP-autentication protected directroy,and put it in a string. With this string you can continue, whether you would like to write it to a file,or anything you want.So this is a basic,and I think it is pretty much self-explanatory: