mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 03:56:21 +05:30
Cleanup Cloudflare Turnstile function
Fix PHP Notice about Content-type not specified in file_get_contents call to Cloudflare.
This commit is contained in:
parent
c1ae1c2cbf
commit
86039d9dad
1 changed files with 9 additions and 5 deletions
|
|
@ -3679,17 +3679,21 @@ function isTurnstile($turnstileResponse)
|
|||
|
||||
$url = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
|
||||
$data = array('secret' => $private, 'response' => $turnstileResponse, 'remoteip' => $ip);
|
||||
|
||||
|
||||
$query = http_build_query($data);
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
||||
'content' => http_build_query($data))
|
||||
'header' => "Content-Type: application/x-www-form-urlencoded\r\n".
|
||||
"Content-Length: ".strlen($query)."\r\n".
|
||||
"User-Agent:HTMLy/1.0\r\n",
|
||||
'method' => "POST",
|
||||
'content' => $query,
|
||||
)
|
||||
);
|
||||
|
||||
$stream = stream_context_create($options);
|
||||
$fileContent = file_get_contents($url, false, $stream);
|
||||
|
||||
|
||||
if ($fileContent === false) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue