v2.5.2
Giriş yap

Php function içinde database select işlemi

erdem
669 defa görüntülendi

Merhaba Tayfun Erbile'nin geçmişte yaptığı bir recaptcha videosunda şöyle bir kod vardı ben bunu admin panelden kontrol edilebilir hale yani kodları dinamik hale getirmek istiyorum.
Dinamik hale getirmek istediğim kısım ('secret' => '6Ld4b9kZAAAAABCYWhu1kGLIlR-JuqcA3OsxFEWT').
Bi türlü fonksiyonun içindeki o secret alanına etki edemiyorum dinamik olması için function dışında da içinde de
sql sorgusu yazdım ama görmüyor hata veriyor.

function reCaptcha($response) {

	$fields = [
		'secret' => '6Ld4b9kZAAAAABCYWhu1kGLIlR-JuqcA3OsxFEWT',
		'response' => $response
	];

	$ch = curl_init('https://www.google.com/recaptcha/api/siteverify');
	curl_setopt_array($ch, [
		CURLOPT_POST => true,
		CURLOPT_POSTFIELDS => http_build_query($fields),
		CURLOPT_RETURNTRANSFER => true

	]);

	$result = curl_exec($ch);
	curl_close($ch);
	return json_decode($result, true);

	}
zeta
1289 gün önce

function reCaptcha($response, $secretKey) {

$fields = [
	'secret' => $secretKey,
	'response' => $response
];

$ch = curl_init('https://www.google.com/recaptcha/api/siteverify');
curl_setopt_array($ch, [
	CURLOPT_POST => true,
	CURLOPT_POSTFIELDS => http_build_query($fields),
	CURLOPT_RETURNTRANSFER => true

]);

$result = curl_exec($ch);
curl_close($ch);
return json_decode($result, true);

}