Heim  >  Artikel  >  Backend-Entwicklung  >  关于php 接口问题(php接口主要也就是运用curl,curl函数)_PHP教程

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

WBOY
WBOYOriginal
2016-07-21 15:01:46809Durchsuche

接口问题
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);    //关闭

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/327969.htmlTechArticle接口问题 php调用接口最主要的就是使用curl抓取信息 复制代码 代码如下: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);//url地址 curl_setopt($ch,...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn