From e99e0aac211020104b0d78b39ba70a1f65373f36 Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Mon, 26 Nov 2018 18:41:45 +0100 Subject: [PATCH] Ajout d'un exemple pour google recaptcha dans PHP --- HowtoPHP.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/HowtoPHP.md b/HowtoPHP.md index 2df8548e..32ffea2e 100644 --- a/HowtoPHP.md +++ b/HowtoPHP.md @@ -751,3 +751,27 @@ php_admin_value sendmail_path "/bin/true -t -i -f www-foo" ~~~ php_admin_value sendmail_path "/bin/true" ~~~ + +* `allow_url_fopen = Off` empêche d’utiliser file_get_contents + +La solution est d’utiliser +(fsockopen())[https://secure.php.net/manual/fr/function.fsockopen.php] +plutôt que +(file_get_contents())[https://secure.php.net/manual/fr/function.file-get-contents.php]. +Il faut faire attention parce que cette API est aussi vulnérable a +(certaines attaques)[https://www.owasp.org/index.php/PHP_Top_5]. + + +Exemple pour (Google Recaptcha)[http://www.google.com/recaptcha/intro/v3.html]: + +Remplacer + +``` +$recaptcha = new \ReCaptcha\ReCaptcha($secret); +``` + +Par + +``` +$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost()); +``` \ No newline at end of file