// GET请求
public function curlGet($url,$header){
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
$url:'请求的URL';
$header:请求头部,格式如下面所示。
$header = array(
'AppId:'.$shequ['username'],
'AppToken:'.$token,
'AppTimestamp:'.$time,
);
PHP CRUL请求GET、POST
最新推荐文章于 2023-03-31 01:55:00 发布