php调用接口最主要的就是使用curl抓取信息
复制代码 代码如下:
$ch = curl_init();
curl_setopt($ch, curlopt_url, $url); //url地址
curl_setopt($ch, curlopt_post, true); //是否post请求
curl_setopt($ch, curlopt_postfields, $data); //post请求传递的数据
curl_setopt($ch, curlopt_httpheader, $header);//设置header
curl_setopt($ch, curlopt_returntransfer, true);//返回获取的输出文本流
$response = curl_exec($ch); //获取返回的数据
curl_close($ch); //关闭
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!