function kefu_response($openid, $msg, $access_token) { $url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' . $access_token; $mesage = '{"touser":"******", "msgtype":"text", "text": { "content":"' . $msg . '" }}'; api_notice_increment($url, $mesage); }
<?php $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); // 给下列参数赋值 $appid = 'wxfea3e92ddf4936d5'; $secret = '674828c37381378ba816825c3d533a82'; $url_get = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $secret; $json = json_decode(curlGet($url_get)); $access_token = $json->access_token; $openid = $postObj->OpenId; $feedbackid = $postObj->FeedBackId; $url = "https://api.weixin.qq.com/payfeedback/update?access_token=" . $access_token . "&openid=" . $openid . "&feedbackid=" . $feedbackid; $result = api_notice_increment($url); function api_notice_increment($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $tmpInfo = curl_exec($ch); if (curl_errno($ch)) { return $tmpInfo; } else { return $tmpInfo; } }