คือโค้ดที่ผมเขียนไปมันทำงานบน localhost (บนคอมพิวเตอร์ผมเอง)นะครับ แต่พออัพไฟล์ขึ้นไปบน server ดัน ขึ้น error ครับ
ส่วน error นะครับ
Warning: file_get_contents(
https://www.google.com/recaptcha/api/siteverify?secret=xxxxxxxx&response=03AOP2lf4_63SiD9Bo--c1J1GPR0Z49GjHCsRSVMuy85SZBxZsBK1Wc_B_2wueHbv8DqI9MX2akv57wmjIqtkeE_DOJ7fmrsYuJ2J760-IowSx7vSm2TSDa4sAlzEBQp5kYqGH_bwQYPipgH80mGoEVAtVT2i9vNSXmt1seCB3f2qxue6Q6MQPn0xjMyeIOY23Al7wZMQT-diCGF0rqYAGvPP-2P2m3DLstaMMvoJJbM-m-4vkQP4kZX_lp6td1EjCyj6ylqqiUfwjWIF1g3yfgyVQAR9z2sKCRhXeySXKj1MXt6QNHlyalSs&remoteip=1.47.200.35): failed to open stream: A socket operation was attempted to an unreachable network. in C:\xampp\htdocs\u56292\register2.php on line 18
อันนี้โค้ดที่ผมใช้ครับ
if(isset($_POST['Submit'])){
$url = 'https://www.google.com/recaptcha/api/siteverify';
$privatekey = "xxxxxxxxx";
$response = file_get_contents($url."?secret=".$privatekey."&response=".$_POST['g-recaptcha-response']."&remoteip="
.$_SERVER['REMOTE_ADDR']);
$data = json_decode($response);
echo "remoteip = " .$_SERVER['REMOTE_ADDR'];
echo "result of json_decode = " .$data ;
if(isset($data->success) AND $data->success==true){
//ทำส่วนนี้
}
}
ช่วยตรวจ Captcha ให้ผมหน่อยครับ
ส่วน error นะครับ
Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=xxxxxxxx&response=03AOP2lf4_63SiD9Bo--c1J1GPR0Z49GjHCsRSVMuy85SZBxZsBK1Wc_B_2wueHbv8DqI9MX2akv57wmjIqtkeE_DOJ7fmrsYuJ2J760-IowSx7vSm2TSDa4sAlzEBQp5kYqGH_bwQYPipgH80mGoEVAtVT2i9vNSXmt1seCB3f2qxue6Q6MQPn0xjMyeIOY23Al7wZMQT-diCGF0rqYAGvPP-2P2m3DLstaMMvoJJbM-m-4vkQP4kZX_lp6td1EjCyj6ylqqiUfwjWIF1g3yfgyVQAR9z2sKCRhXeySXKj1MXt6QNHlyalSs&remoteip=1.47.200.35): failed to open stream: A socket operation was attempted to an unreachable network. in C:\xampp\htdocs\u56292\register2.php on line 18
อันนี้โค้ดที่ผมใช้ครับ
if(isset($_POST['Submit'])){
$url = 'https://www.google.com/recaptcha/api/siteverify';
$privatekey = "xxxxxxxxx";
$response = file_get_contents($url."?secret=".$privatekey."&response=".$_POST['g-recaptcha-response']."&remoteip="
.$_SERVER['REMOTE_ADDR']);
$data = json_decode($response);
echo "remoteip = " .$_SERVER['REMOTE_ADDR'];
echo "result of json_decode = " .$data ;
if(isset($data->success) AND $data->success==true){
//ทำส่วนนี้
}
}