Martina H.: HTTP Authentifizierung übersenden

Beitrag lesen

Danke Horst,

habs jetzt versucht:

$credentials = base64_encode('user:pw');  
  
$sock = socket_create(AF_INET, SOCK_STREAM, 0);  
$status = socket_connect($sock, 'webseite.ath.cx', 80);  
$status = socket_write($sock, "GET /hcs_stat.cgi?trc0p0=333 HTTP/1.0\nAuthorization: Basic $credentials\n\n");  
$status = socket_read($sock, 1024, PHP_BINARY_READ);

Klappt aber leider nicht ganz, bekomme als antwort:
HTTP/1.0 401 Unauthorized WWW-Authenticate: Basic realm="default" Authentication Required!

Brauche ich eine andere Art?

LG, Martina