4

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

1
  • 1
    Doing what? Using which functions? Commented Aug 15, 2010 at 14:53

1 Answer 1

4

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.