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

Configurable proxy #31

Open
MVnComputers opened this issue Dec 13, 2019 · 2 comments
Open

Configurable proxy #31

MVnComputers opened this issue Dec 13, 2019 · 2 comments

Comments

@MVnComputers
Copy link

MVnComputers commented Dec 13, 2019

Hi, is it possible to make a configurable proxy? Our company policy will not allow that file_get_contents request.
Specifically, the file is ReCaptchaProvider.php, function makeRequest (), line 102.

Now I have to make a hard adjustment to:

$aContext = array(
	'http' => array(
		'proxy '=> 'proxyXYZ.de:8000',
		'request_fulluri' => true,
	),
);
$context = stream_context_create($aContext);

return @file_get_contents($this->buildUrl($params), false, $context);

Otherwise, the recaptcha always returns to me that I am a robot

@f3l1x
Copy link
Member

f3l1x commented Feb 24, 2020

Hey @MVnComputers. Sure, could you please more elaborate a propose some http client changes? Thanks man.

@latisak
Copy link

latisak commented Mar 10, 2022

Hi guys, I have same situation as MVnComputers. My servers are behind proxy server so I had to hardcode stream_context_create as example above in file ReCaptchaProvider.php, function makeRequest (), line 102.

      /**
	 * @param mixed $response
	 * @return mixed
	 */
	protected function makeRequest($response, ?string $remoteIp = null)
	{
		if (empty($response)) {
			return null;
		}

		$params = [
			'secret' => $this->secretKey,
			'response' => $response,
		];

		if ($remoteIp !== null) {
			$params['remoteip'] = $remoteIp;
		}

		return @file_get_contents($this->buildUrl($params), false, stream_context_create(array(
                    'http' => array(
                        'proxy'           => '192.168.41.240:3128',
                        'request_fulluri' => true,
                    ),
                )));
	}

Is it possible to integrate optional arguments to neon configuration file like?

 recaptcha:
 	secretKey: xxx 
 	siteKey: xxx 
        proxy: 
                 host: xxx 
                 port: 3128

Thanks

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

No branches or pull requests

3 participants