//function request_post($url = '', $param = '') {
// if (empty($url) || empty($param)) {
// return false;
// }
//
// $postUrl = $url;
// $curlPost = $param;
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL,$postUrl);
// curl_setopt($ch, CURLOPT_HEADER, 0);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
// $data = curl_exec($ch);
// curl_close($ch);
// return $data;
//}
function http_request($url, $headers = array(),$data = null)
{
$curl = curl_init();
if (count($headers) >= 1) {
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($c
【收藏!】php调用接口: 通过post提交请求
于 2021-06-22 15:29:01 首次发布

订阅专栏 解锁全文
671





