当前位置: 移动技术网 > IT编程>开发语言>PHP > 关于php 接口问题(php接口主要也就是运用curl,curl函数)

关于php 接口问题(php接口主要也就是运用curl,curl函数)

2019年05月24日  | 移动技术网IT编程  | 我要评论
接口问题
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);    //关闭

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网