3 回复
/**
\* 发送post请求
\* [@param](/user/param) string $url 请求地址
\* [@param](/user/param) array $data\_string post键值对数据,用json\_encode格式
\*/
function http_post($url, $data_string) {
$ch = curl\_init();
curl\_setopt($ch, CURLOPT\_URL, $url);
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);
curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(
'X-AjaxPro-Method:ShowList',
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($data\_string))
);
curl\_setopt($ch, CURLOPT\_POST, 1);
curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data\_string);
$data = curl\_exec($ch);
curl\_close($ch);
return $data;
}
$url = ‘http://api.weixin.qq.com/wxa/business/getliveinfo?access_token=’.$token;
$data=json_encode(array(
“start”=>0,
“limit”=>10
));
echo $result=http_post($url,$data);
/*亲测可以*/