set_proxy ( $proxy )

Set the proxy to use for making requests.

Access

public

Parameters

Parameter

Type

Required

Description

$proxy

string

Required

The faux-url to use for proxy settings. Takes the following format: proxy://user:pass@hostname:port

Returns

Type

Description

$this

A reference to the current instance.

Examples

Pass in a proxy DSN string, and process it with prep_request() (without firing the request).

$http = new RequestCore('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt');
$http->set_proxy('proxy://user:pass@hostname:80');
$http->prep_request();

var_dump($http->proxy);
Result:
array(5) {
  ["scheme"]=>
  string(5) "proxy"
  ["host"]=>
  string(8) "hostname"
  ["port"]=>
  int(80)
  ["user"]=>
  string(4) "user"
  ["pass"]=>
  string(4) "pass"
}

Source

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback