curl post方法

时间:2021-01-31 10:27:24
 * [curl_post curl post方式请求接口]
* @param [type] $url [接口的url]
* @param [type] $data [传递的参数]
* @return [type] [返回接口信息]
*/
private function curl_post($url, $data) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, );
curl_setopt($ch, CURLOPT_HEADER, );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, );
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$return = curl_exec($ch);
$status = curl_getinfo($ch);
curl_close($ch);
if(intval($status["http_code"]) == ) {
return $return;
} else {
echo $status["http_code"];
return false;
}
}