Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Curl Recaptcha无法获取响应成功属性_Php_Curl_Recaptcha - Fatal编程技术网

PHP Curl Recaptcha无法获取响应成功属性

PHP Curl Recaptcha无法获取响应成功属性,php,curl,recaptcha,Php,Curl,Recaptcha,在尝试对表单提交执行recaptcha检查时,我似乎无法获得响应的正确success属性。(运行PHP native 5.3的服务器) 即使我选中该框,if语句也总是解析并运行echo并抛出异常 { "success": true, "challenge_ts": "2017-04-24T18:28:48Z", "hostname": "mysite.com" }<br /> <b>Fatal error</b>: Uncaught exception 'Ex

在尝试对表单提交执行recaptcha检查时,我似乎无法获得响应的正确success属性。(运行PHP native 5.3的服务器)

即使我选中该框,if语句也总是解析并运行echo并抛出异常

{ "success": true, "challenge_ts": "2017-04-24T18:28:48Z", "hostname": "mysite.com" }<br /> <b>Fatal error</b>: Uncaught exception 'Exception' with message 'Gah! We seemed to have encountered an error. Please try again.' in ...process.php:23 Stack trace: #0 {main} thrown in <b>...process.php</b> on line <b>23</b><br /> 
返回

<br /> <b>Catchable fatal error</b>: Object of class stdClass could not be converted to string in <b>mysite.com/test/portfolio/php/process.php</b> on line <b>21</b><br /> 

可捕获的致命错误:在第21行的mysite.com/test/portfolio/php/process.php中,stdClass类的对象无法转换为字符串

您必须解码结果

$result = json_decode(curl_exec($curl));

我已经试过了,但只收到了可捕获的致命错误:在第21行mysite.com/test/portfolio/php/process.php中,stdClass类的对象无法转换为字符串
这解决了我的问题,我将服务器的php版本从5.3更新到5.6Try,以便在使用$g_result=json解码时为我提供print_r($g_result)($result,true);
Array([success]=>1[challenge_ts]=>2017-04-24T19:16:41Z[hostname]=>tedmoke.com)成功
现在是echo'edMy server运行本机PHP 5.3的唯一原因,这可能是问题的一部分吗?为什么使用triple=?您有什么具体原因吗?Try only==我已经尝试过了'==我也尝试过了!$result->success
<br /> <b>Catchable fatal error</b>: Object of class stdClass could not be converted to string in <b>mysite.com/test/portfolio/php/process.php</b> on line <b>21</b><br /> 
$result = json_decode(curl_exec($curl));