PHP WebSocket2 Library
PHP5 Library for browsing web
basic_http_authentication.php

This is an example of how to use automatic basic or digest HTTP authentication.

<?php
require '../websock2.php';
//Create request manager, supply it with socket and cookie manager
//Add authentication data for all realms
$manager->addAuthData(null, 'user', 'passwd');
//Run request and echo response body contents (without headers)
//This will automatically process basic authentication
echo $manager->runRequest(WebRequest::createFromUrl('http://httpbin.org/basic-auth/user/passwd'))->getBody();
//Run request and echo response body contents (without headers)
//This will automatically process digest "auth-int" authentication
echo $manager->runRequest(WebRequest::createFromUrl('http://httpbin.org/digest-auth/auth-int/user/passwd'))->getBody();