Re: HTTP Authentication thru PHP

From: Date: Wed, 19 Nov 2003 14:45:49 +0000
Subject: Re: HTTP Authentication thru PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170294@lists.php.net to get a copy of this message
its probably because its possible to authenticate with an url ? eg http://name:pass@www.thisdomain.com Chandu Nannapaneni wrote:
hello all , I'm able to get successfully http authenticated from my php scripts Ex :
    $header = "POST /myscript.php HTTP/1.0\r\nAuthorization: Basic ";
    $header .= base64_encode("$username:$password")."\r\n";
    $header .= "Content-type: application/x-www-form-urlencoded\r\n";
    ........
    $fp = fsockopen($IP, $PORT, $errno, $errstr);
    if ($fp) {  fputs($fp, $header . $request); while (!feof($fp)) {
$response .= fgets($fp, 128); } } But the above is not working when the $username contains a trailing semicolon or when the $password is starting with a semicolon, Ex: what if the $username ="chandu:" Is there any solution for this ? /Chandu


« previous php.general (#170294) next »