Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Latest commit

 

History

History
50 lines (36 loc) · 1008 Bytes

proxy.md

File metadata and controls

50 lines (36 loc) · 1008 Bytes

Proxy usage

No authentication

To set up proxy settings use useProxy method:

$bot->getHttpClient()->useProxy('192.168.1.1', '12345');

With authentication

By default it uses http proxy without authentication. If your proxy requires authentication, pass auth string as the third parameter:

$bot->getHttpClient()->useProxy('192.168.1.1', '12345', 'username:password');

Socks

Use socks proxy:

$bot->getHttpClient()->useSocksProxy('192.168.1.1', '12345');

// With authentication
$bot->getHttpClient()->useSocksProxy('192.168.1.1', '12345', 'username:password');

Cancel proxy

If you need to stop sending requests via proxy:

$bot->getHttpClient()->dontUseProxy();

Check if uses

Check if bot uses proxy:

if($bot->getHttpClient()->usesProxy()) {
    // ...
}