curl与https

未结帖
0 1787
ajian lucy 2017-03-31
悬赏:5飞吻
//curl 之 get
protected function curl_get($url) {
   $curl = curl_init();
   curl_setopt($curl, CURLOPT_URL, $url);
   curl_setopt($curl, CURLOPT_HEADER, 0); //1 返回报文头信息 0 不返回
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  //0 直接模拟浏览器打开请求地址(不将结果返回,直接输出);1 返回结果
   curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);//这个是重点。
   $data = curl_exec($curl);
   curl_close($curl);
   return json_decode($data,true);
}


热忱回答0


最近热帖

近期热议

  1. javascript——prototype与__proto 9
  2. Mysql 中出现的Data truncated for column 3
  3. 在nginx中使用x-sendfile的解决方案 3
  4. 高版本jQuery面插件实现Ajax上传图片 1
  5. Thinkphp Socket.class.php 类的使用 1
  6. 使用ionic3创建第一个App 0
  7. ios-oc html5 0
  8. nginx.conf 0
  9. 基于ionic3.4.0的项目搭建 0
  10. php 缩略图 0