PHP调用http接口
时间:2021-07-01 10:21:17
帮助过:3人阅读
- //http请求接口
- function curl_http_request($param,$url)
- {
- $ch = curl_init();
- $curl_url = $url."?".$param;
- curl_setopt($ch, CURLOPT_URL, $curl_url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); //禁用证书
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- curl_setopt ($ch, CURLOPT_HEADER, 0); //头文件信息做数据流输出
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//不直接输出,返回到变量
- $curl_result = curl_exec($ch);
- curl_close($ch);
-
- return $curl_result;
- }
|
PHP, http