You don't specify which type of authentication is being used on the remote side, hence, I'm going to make some guesses and assumptions:
Basic HTTP Authentication
If "Basic HTTP Authentication" is used (Which would show a browser pop-up requesting username/password for the realm), you can formulate your request URL as follows:
http://username:password@host.name/file.name?parameter=x
Where:
username
is your actual known username
password
the actual password
host.name
the address of the remote server,
file.name
the PHP file you are trying to access
- optional:
parameter=x
any known parameters required to get the required output from the PHP file
PHP Authentication
If the actual authentication is done by the PHP page itself it's a different story. In that case it all depends on which variables the PHP script uses to perform authentication, specifically which type of parameter. Most commonly GET
or POST
are used (or if REQUEST
is used, both will work).
Either way, you will have to know the name of the parameter that is being used. I'm going to assume user
and pass
for the examples below.
In the PHP script these will look like $_GET['user']
, $_POST['user']
, $_REQUEST['user']
or simply $user
if the dangerous register_globals is set in php.ini
.
In case of GET
or REQUEST
:
http://host.name/file.name?user=username&pass=password¶meter=x
In case of POST
:
It is possible to POST
values using JavaScript. This SO answer gives a working examle.
Anything else
If any other method (and there are plenty others) is used, more specific information is required to determine the exact method and a working solution.