guzzle / guzzle

Guzzle, an extensible PHP HTTP client

Home Page:https://docs.guzzlephp.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proxy chain support

dinamic opened this issue · comments

Description
It'd be great if we could define a proxy chain. We would be able to define a path to a proxy, which goes thru another proxy.

Example

In terms of configuration, maybe we could support passing an array instead of a string as http and https proxies.

$client->request('GET', '/', [
    'proxy' => [
        'http'  => ['socks5://a.b.c.d:1080', 'socks5://z.x.c.v:31337']
        'https' => ['socks5://a.b.c.d:1080', 'socks5://z.x.c.v:31337']
        'no' => ['.mit.edu', 'foo.com']    // Don't use a proxy with these
    ]
]);

In this configuration, we should first connect to a.b.c.d in order to connect to z.x.c.v and then issue the request to the web server.

Not sure if this is possible today. If it is, maybe the documentation needs clearing up a bit.

Thanks for getting in touch. No, this is not possible, not just due to Guzzle, but due to the nature of how HTTP proxies work. See https://stackoverflow.com/questions/8022672/curl-using-multiple-proxies-in-a-chain which has been answered by the author of libcurl.