<?php
header("Content-type: text/html; charset=utf-8");

function gbk_to_utf8($str){
    return mb_convert_encoding($str, 'utf-8', 'gbk');
}

$aywxfrom  = $_GET['aywxfrom'];
$hfcon  = $_GET['hfcon'];

$access_token = $_GET['access_token'];


$result = _reply_customer($aywxfrom,$hfcon,$access_token);



	function _reply_customer($touser,$content,$access_token){

    
    $data = '{
        "touser":"'.$touser.'",
        "msgtype":"text",
        "text":
        {
             "content":"'.gbk_to_utf8($content).'"
        }
    }';
    $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$access_token;
	
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url); 
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);
	
	echo $result;
}
?>
