Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Socks 5? #1636

Closed
DenoBY opened this issue Oct 29, 2016 · 7 comments
Closed

How to use Socks 5? #1636

DenoBY opened this issue Oct 29, 2016 · 7 comments
Assignees

Comments

@DenoBY
Copy link

DenoBY commented Oct 29, 2016

Show an example of how to use please Socks5 in guzzle

@sagikazarmark
Copy link
Member

Have you tried setting the proxy option to something like socks5://localhost:2001?

@DenoBY
Copy link
Author

DenoBY commented Oct 30, 2016

$this->client = new Client([
    'headers' => [
        'Host' => 'www.exemple.com',
         'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; rv:49.0) Gecko/20100101 Firefox/49.0',
    ],
    'base_uri' => 'https://www.exemple.com/',
    'cookies' => $this->cookie,
    'proxy' => 'socks5://exemple:45554'
]);

PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Error creating resource: [message] fopen(https://www.exemple.com/): failed to open stream: Unable to find the socket transport "socks5" - did you forget to enable it when you configured PHP?

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ConnectException' with message 'cURL error 7: Unable to receive initial SOCKS5 response. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\Users\Home\PhpstormProjects\fbp\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:186
Stack trace:
#0 C:\Users\Home\PhpstormProjects\fbp\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 C:\Users\Home\PhpstormProjects\fbp\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 C:\Users\Home\PhpstormProjects\fbp\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 C:\Users\Home\Phpstor in C:\Users\Home\PhpstormProjects\fbp\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 186

@sagikazarmark In what may be a problem?

@sagikazarmark sagikazarmark self-assigned this Oct 31, 2016
@sagikazarmark
Copy link
Member

I will take a look at it

@DenoBY
Copy link
Author

DenoBY commented Nov 1, 2016

@sagikazarmark The problem was due to the fact that the socks had to call the above.

$this->client = new Client([
    'headers' => [
        'Host' => 'www.exemple.com',
         'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; rv:49.0) Gecko/20100101 Firefox/49.0',
    ],
    'proxy' => 'socks5://exemple:45554'
    'base_uri' => 'https://www.exemple.com/',
    'cookies' => $this->cookie
]);

I have an anonymous socks and I can not get authorization. Maybe you know how? 'proxy' => 'socks5://login:pass@exemple:45554' does not work

@nesttle
Copy link

nesttle commented Nov 6, 2016

Same here (auth to proxy not working)

@sagikazarmark
Copy link
Member

Hm, is this a duplication of #1484?

@sagikazarmark
Copy link
Member

Closing this in favor of #1484

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants