如以下代码,怎么木有任何反应,也木有任何返回值,是什么鬼,有前辈能指教下么
<?php$urls="https://oapi.dingtalk.com/robot/send?access_token=XXXXXXXXXXXXXXXXXXXXXX";
$messages="测试机器人吧";$data = array ('msgtype' => 'text','text' => array ('content' => $messages,),'at' => array ('atMobiles' => array (),'isAtAll' => false,),);
$data_string = json_encode($data);//echo $data_string;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/json; charset=utf-8'));curl_setopt($ch, CURLOPT_URL,$urls);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string); $retBase = curl_exec($ch);
curl_close($ch);
//echo $retBase;
//根据返回值做出判断,不是成功直接抛出返回的JSON。$ret=json_decode($retBase,true);
//echo $ret."<br>";if ($ret["errmsg"]=="ok" && $ret["errcode"]=="0" )
{echo "成功";
}else{echo "失败";
}
?>
list($s1, $s2) = explode(' ', microtime());
$timestamp = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
$secret = 'xxxxx';
$data = $timestamp . "\n" . $secret;
$signStr = base64_encode(hash_hmac('sha256', $data, $secret));
$signStr = utf8_encode(urlencode($signStr));
$webhook = "https://oapi.dingtalk.com/robot/send?access_token=xxxxx";
$webhook .= "×tamp=$timestamp&sign=$signStr";
这总是提示签名不匹配是怎么肥四{"errcode":310000,"errmsg":"sign not match"}
-------------------------
-------------------------
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。