Page 1 of 1

Automating HTTP Authentication problem

Posted: Sat Oct 28, 2006 3:17 pm
by machek
Automating HTTP Authentication was easy think before Microsoft made MS04-004 Cumulative Security Update for Internet Explorer (832894). It is not possible do things like http://name:password@site.com any more.

I have web cam, and for access to web cam is requiring Http Authentication. I tried hard, but I didn't find working solution. Idea was to do something like this, to do Automating HTTP Authentication:

Code: Select all

$sAuth = base64_encode("webcam:webcam"); 
$sHTTP = "GET /cgi-bin/video.jpg HTTP/1.1\r\n
Accept: image/jpeg\r\n
Connection: close\r\n
Host: 192.168.1.10\r\n";

$hSocket = fsockopen("192.168.1.10", 80); 
fputs($hSocket, $sHTTP.$sAuth."\r\n"); 
fclose($hSocket);
Or simililar
http://www.informit.com/articles/articl ... 55423&rl=1

Server(Web cam) is just returning HTTP/1.0 200 OK, but when I try to click to view image, immediately is again asking for authorization.

Nothing is working. Does anybody know easy way in PHP how to sort out problem Automating HTTP Authentication?

Posted: Sat Oct 28, 2006 3:38 pm
by volka

Code: Select all

$contents = file_get_contents('http://name:password@site.com');
php's http wrapper still supports n:p@site