php

跳过ssl和443请求

2018-08-16  本文已影响0人  落魄PHP女程序员

function BaijiesudaiCurl($url,$post_data=null){

      $headers = ['Content-Type:'.'application/json;charset=UTF-8'];

      $ch = curl_init();

      curl_setopt($ch, CURLOPT_POST, 1);

      curl_setopt($ch, CURLOPT_HEADER, 0);

      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

      // //http://192.168.0.51:8081/insurance/callBack白洁测试白洁测试地址没钞蜂

      curl_setopt($ch, CURLOPT_URL,$url);

      curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($post_data));

      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//绕过ssl验证

      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

      $result = curl_exec($ch);

      curl_close($ch);

      return $result;

  }

上一篇下一篇

猜你喜欢

热点阅读