<?php
	session_start();
	
	include "wechat.class.php";
	include 'errCode.php';
	require_once("../Wx.Config.php");


	/*
	$opt = array(
		'appsecret'=>WxMainConfig::APPSECRET,//填写高级调用功能的密钥
		'appid'=>WxMainConfig::APPID	//填写高级调用功能的appid
	);
	$we = new Wechat($opt);
	$auth = $we->checkAuth();
	//var_dump($auth);
	$js_ticket = $we->getJsTicket();
	
*/

	//header("Content-type: text/html; charset=gb2312"); 

	
	$sendText=$_REQUEST["sendmsg"];
			
	$data = '{
	"touser":"'.$_SESSION["main_vipwxudid"].'",
	"msgtype":"text",
	"text":
		{
			"content":"'.$sendText.'"
		}
	}';
	
	$url1 = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$_SESSION["main_access_token"];
	$curl1 = curl_init();

	curl_setopt($curl1, CURLOPT_URL, $url1);
	curl_setopt($curl1, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($curl1, CURLOPT_SSL_VERIFYHOST, FALSE);
	curl_setopt($curl1, CURLOPT_POST, 1);
	curl_setopt($curl1, CURLOPT_POSTFIELDS, $data);
	curl_setopt($curl1, CURLOPT_RETURNTRANSFER, 1);
	$result = curl_exec($curl1);
	if(curl_errno($curl1)) 
	{
		return 'Errno'.curl_error($curl1);
	}
	curl_close($curl1);
	
	//echo $url1;
?>



