Skip to content

2.2.0

Compare
Choose a tag to compare
@ahmadnassri ahmadnassri released this 05 Feb 17:28
· 65 commits to master since this release

Advanced Authentication Methods

Unirest\Request::auth($username, $password = '', $method = CURLAUTH_BASIC);

Supports Basic, Digest, Negotiate, NTLM Authentication natively, see README for more details.

Proxy Support

Unirest\Request::proxy($address, $port = 1080, $type = CURLPROXY_HTTP, $tunnel = false);
  • proxy port defaults to 1080 as per cURL defaults

  • check the cURL docs for more info on tunneling.

  • proxy type to be one of CURLPROXY_HTTP, CURLPROXY_HTTP_1_0, CURLPROXY_SOCKS4, CURLPROXY_SOCKS5, CURLPROXY_SOCKS4A, and CURLPROXY_SOCKS5_HOSTNAME.

    check the cURL docs for more info.

full usage example:

// quick setup with default port: 1080
Unirest\Request::proxy('10.10.10.1');

// custom port and proxy type
Unirest\Request::proxy('10.10.10.1', 8080, CURLPROXY_HTTP);

// enable tunneling
Unirest\Request::proxy('10.10.10.1', 8080, CURLPROXY_HTTP, true);

Proxy Authentication

Unirest\Request::proxyAuth($username, $password = '', $method = CURLAUTH_BASIC);

Supports Basic, Digest, Negotiate, NTLM Authentication natively, see README for more details.