\n\n","codes":[{"file":"gogle.php2","code":" script\n //.g-recaptcha タグの data-callback 属性で指定したコールバック関数の定義\n var myAlert = function(response) {\n alert(\"チェックボックスがチェックされました!\");\n };\n\n var verifyCallback = function(response) { //コールバック関数の定義\n //#warning の p 要素のテキストを空にf\n document.getElementById(\"warning\").textContent = '';\n //#send の button 要素の disabled 属性を解除\n document.getElementById(\"send\").disabled = false;\n };\n var expiredCallback = function() { //コールバック関数の定義\n //#warning の p 要素のテキストに文字列を設定\n document.getElementById(\"warning\").textContent = '送信するにはチェックを入れてください。';\n //#send の button 要素に disabled 属性を設定\n document.getElementById(\"send\").disabled = true;\n };\n /script\n\n \t\n
\n

\n※認証に失敗しました。\n
\n \n
\n\n\t\n\n\n $secretKey, //シークレットキー\n 'response' => $_POST[ 'g-recaptcha-response' ] //トークンを送信する\n );\n //POST メソッドを使用(curlを使った処理の方がfile_get_contentsを使うよりも高速かつ、エラー処理がしやすい)\n $context = array(\n 'http' => array(\n 'method' => 'POST',\n 'header' => implode(\"\\r\\n\", array('Content-Type: application/x-www-form-urlencoded',)),\n 'content' => http_build_query($data)\n )\n );\n //上記パラメータを指定して file_get_contents で API Response を取得\n $api_response = file_get_contents($url, false, stream_context_create($context));\n \n // JSON をデコード\n $result = json_decode( $api_response );\n // トークンが有効な場合\n if ( $result->success ) {\n return true;\n // 成功した場合の処理(メールの送信など)を実行(または結果を変数に入れて、その変数を使って処理を分岐するなど)\n } else { // トークンが無効な場合\n return false;\n }\n}\n ?>"}],"stdin":"","compiler":"php-8.0.3","options":"","compilerOptionRaw":"","runtimeOptionRaw":"","createdAt":1671021802,"title":"gogle.php1","description":"","githubUser":"pktogtyaj","isPrivate":false,"compilerInfo":{"name":"php-8.0.3","version":"8.0.3","language":"PHP","displayName":"php","templates":["php"],"compilerOptionRaw":false,"runtimeOptionRaw":true,"displayCompileCommand":"php prog.php","switches":[]}},"results":[{"type":"Control","data":"Start"},{"type":"StdOut","data":"script\n var verifyCallback = function(response) { //.g-recaptcha タグの data-callback 属性で指定したコールバック関数の定義\n //#warning の p 要素のテキストを空に\n document.getElementById(\"warning\").textContent = '';\n //#send の button 要素の disabled 属性を解除\n document.getElementById(\"send\").disabled = false;\n };\n var expiredCallback = function() { //コールバック関数の定義\n //#warning の p 要素のテキストに文字列を設定\n document.getElementById(\"warning\").textContent = '送信するにはチェックを・・・';\n //#send の button 要素に disabled 属性を設定\n document.getElementById(\"send\").disabled = true;\n };\n/script\n\n\n

g-recaptcha タグを使って表示

\n
\n
\n

送信するにはチェックを入れてください。

\n \n
\n \n\n\nWarning: Undefined array key \"g-recaptcha-response\" in /home/jail/prog.php on line 26\n"},{"type":"StdOut","data":"\nFatal error: Uncaught Error: Call to undefined function curl_init() in /home/jail/prog.php:38\nStack trace:\n#0 {main}\n thrown in /home/jail/prog.php on line 38\n"},{"type":"ExitCode","data":"255"},{"type":"Control","data":"Finish"}]}}