获取接口数据 //curl get function curl_get($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $dom = curl_exec($ch); curl_close($ch); return $dom; } //curl post function curl_post($url, $postdata) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postdate); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); return $result; }
使用PHP的CURL函数获取数据(POST和GET)
最新推荐文章于 2022-03-26 12:53:14 发布