tags:

views:

42

answers:

1

May you give me an example for using an HTTP proxy in PHP?

+1  A: 

If you want to use PHP to make an HTTP request via a proxy, you can use the proxy context option.

Example:

$opts = array('http' =>
    array(
        'proxy'  => 'tcp://proxy.example.com:5100',
    )
);

$context  = stream_context_create($opts);
$result = file_get_contents('http://example.com/somefile.html', false, $context);
thomasrutter