PHP模拟POST请求

xiaoxiao2021-02-27  366

//模拟post请求 //url 请求地址 //post_data 请求参数 public function sendPost($url,$post_data){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); $data = curl_exec($ch); //var_dump($data);

}

转载请注明原文地址: https://www.6miu.com/read-4224.html

最新回复(0)