/** * curl模拟get请求 * @param 请求地址 $url * @return 接口返回数据(数组形式) 调用:$res=curl_get($url); */ function curl_get($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURL_SSLVERSION_SSL, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); $response = json_decode($data, true); return $response; }