Home > Backend Development > PHP Tutorial > 关于php 接口问题(php接口主要也就是运用curl,curl函数)_php技巧

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-17 08:57:27
Original
1235 people have browsed 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);    //关闭
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template