<?php
function post($url, $jsonData){
$ch = curl_init($url) ;
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS,$jsonData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch) ;
curl_close($ch) ;
return $result;
}
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=VzR_4bVUteovWOBzxdfgEAQ-qB5bQoMD0ucdU8dYf0snkfP8uqhQVLW4Kj2M-AXYdyQSS7FyzLb8XTwHKRJ1ORHbkwx_t1SkWxiupNRiJuzpbXpxfngF-zMccX4FGb39CBDdACAGFH";
$data = "{
\"button\": [
{
\"type\": \"click\",
\"name\": \"今日歌曲\",
\"key\": \"V1001_TODAY_MUSIC\"
},
{
\"name\": \"菜单\",
\"sub_button\": [
{
\"type\": \"view\",
\"name\": \"获OPENID\",
\"url\": \"http://xtmp1.applinzi.com/getcode.php\"
},
{
\"type\": \"view\",
\"name\": \"视频\",
\"url\": \"http://v.qq.com/\"
},
{
\"type\": \"click\",
\"name\": \"赞一下我们\",
\"key\": \"V1001_GOOD\"
}
]
}
]
}";
post($url,$data);
?>