通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
``` php curl Content-Type: application/json' protected function json_post($url,$data=[]){ $data=json_encode($data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); // POST数据 curl_setopt($ch, CURLOPT_POST, 1); // 把post的变量加上 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data))); $output = curl_exec($ch); curl_close($ch); return $output; } ``` 微擎ihttp_get方法请求结果的封装 直接返回 content的内容 ``` /** * 统一请求函数 * @return JSON */ protected static function get_content($apiurl) { $result = ihttp_get($apiurl); if ($result['code'] != 200) { return error(-1, $result['content']); } $content = @json_decode($result['content'], true); if (!is_array($content)) { return error(-1, $result['content']); } if ($content['status'] != 0) { return error($content['status'], $content['message']); } return $content; } ```