$appid = "wx0f412c1bcb393318";

$secret = "5c19f93471ff857885a67813c67220ec";

$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret;


$res = file_get_contents($url);

$data = json_decode($res);

var_dump($data->access_token);


$jsapi_ticket_json = file_get_contents('https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token='.$data->access_token.'&type=jsapi');

$jsapi_ticket_obj = json_decode($jsapi_ticket_json);


$jsapi_ticket = $jsapi_ticket_obj->ticket;

$noncestr = 'qwertyuiop';

$timestamp = time();

$signature = sha1(sprintf('jsapi_ticket='.$jsapi_ticket.'&noncestr='.$noncestr.'×tamp='.$timestamp.'&url=http://wangbao.bwphp.cn/wx_sample.php'));

?>


########################resourceid