public
function
testWeixin(){
$access_token
=
$this
->getAccessToken();
$customMessageSendUrl
= 'https:
$description
= '今天天气的详细信息(从第三方获取)。';
$url
= 'http:
$picurl
= 'http:
$postDataArr
=
array
(
'touser'=>'OPENID',
'msgtype'=>'news',
'news'=>
array
(
'articles'=>
array
(
'title'=>'当天天气',
'description'=>
$description
,
'url'=>
$url
,
'picurl'=>
$picurl
,
),
),
);
$postJosnData
= json_encode(
$postDataArr
);
$ch
= curl_init(
$customMessageSendUrl
);
curl_setopt(
$ch
, CURLOPT_HEADER, 0);
curl_setopt(
$ch
, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(
$ch
, CURLOPT_POST, 1);
curl_setopt(
$ch
, CURLOPT_POSTFIELDS,
$postJosnData
);
curl_setopt(
$ch
, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt(
$ch
, CURLOPT_SSL_VERIFYHOST, FALSE);
$data
= curl_exec(
$ch
);
var_dump(
$data
);
}