How to authenticate?

mmo

New member
Joined
Aug 4, 2006
Messages
4
I am trying to send a command to the DirectAdmin API using this code:

PHP:
$diskUsage = file_get_contents('http://my_username:[email protected]:2222/CMD_API_SHOW_USER_USAGE?user=some_username');
echo "Disk Usage is: $diskUsage";
This is the error message I receive:
Warning: file_get_contents(http://[email protected]:2222/CMD_API_SHOW_USER_USAGE?user=some_username) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized


Note that I am using the PHP function file_get_contents() and not getfilecontents() as I saw elsewhere in this forum.

Does anyone know what I'm doing wrong here? Thanks in advance for your help.
 
Back
Top