/* PHP CURL HTTPS GET*/
function curl_get_https($url){
    $curl = curl_init(); // 启动一个CURL会话
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);  // 从证书中检查SSL加密算法是否存在
    $tmpInfo = curl_exec($curl);     //返回api的json对象
    //关闭URL请求
    curl_close($curl);
    return $tmpInfo;    //返回json对象
}
public function test(){
    $url = 'http://i.yjapi.com/ECIV4/Search?';
    $key = '';
    $keyword = '小桔科技';
    $get = http_build_query(array('key'=>$key,'keyword'=>$keyword));
    $rs = $this->curl_get_https($url.$get);
    echo $rs;
}

返回值:

{
"Status": "202",
"Message": "传入参数有误,请检查",
"OrderNumber": null,
"Paging": null,
"Result": null
}

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注