previousRequest headers (Previous) (Next) Response Evaluationnext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Proxy Authorization

Proxy Authorization – Making use of a HTTP proxy

How to use Proxy Authorization

Using a proxy server with anonymous access

In this example it is assumed that one wants to use the machine with the hostname proxy.example.com, where a proxy server is listening on port 8080, to proxy the outgoing connection to example.com.

The second parameter of setProxy() is optional and defaults to 8080.

<?php
require_once "HTTP/Request.php";

$req =& new HTTP_Request("http://example.com/");
$req->setProxy("proxy.example.com"8080);
?>

Using proxy authorization

This is the same example as above, except that a username/password tuple is provided, which authorizes the user at the proxy server: The username is johndoe and the appendant password is foo.

<?php
require_once "HTTP/Request.php";

$req =& new HTTP_Request("http://example.com/");
$req->setProxy("proxy.example.com"8080"johndoe""foo");
?>
previousRequest headers (Previous) (Next) Response Evaluationnext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.