/**
* @param $url 请求url
* @param $header 头部信息
* @param $postDate post变量
* @return array
*/
public function insureApi($url,$header,$postDate){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// header信息
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
// post数据
curl_setopt($ch, CURLOPT_POST, 1);
// post变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $postDate);
$output = curl_exec($ch);
curl_close($ch);
return json_decode($output);
}
$url = 'http://servicetest.chetell.com/v1/test';
$header = array("token:88");
$post_data = array (
'page_size' => '10',
'page_number' => '1',
);
$output = $this->insureApi($url,$header,$post_data);