电影热搜API及微信菜单自定义开发
2017-11-02 21:03
99 查看
热搜电影API
$movieApi = "http://api.map.baidu.com/telematics/v3/movie?qt=hot_movie&location={$jd},{$wd}&output=json&ak=SnF72fxXpr2mAaS7FBMsyC4o07YbfMvk";
$hot_movie = file_get_contents($movieApi);
$hot_movie = json_decode($hot_movie,true)['result']['movie'];
print_r( $hot_movie );
foreach ( $hot_movie as $key => $value ) {
?>
<img src="<?php echo $hot_movie[$key]['movie_picture'] ?>">
<?php
}
微信菜单:
$appid = 'wx4621b6f3291a8800';
$appsecret = '5983fc4277b2fe470bab4fab18b938a1';
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
$res = file_get_contents($url);
$res = json_decode($res,true);
$access_token = $res['access_token'];
echo $access_token;
$menuapi = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$access_token}";
$menu = '{
"button":[
{
"name":"电影搜搜",
"sub_button":[
{
"type":"view",
"name":"网盘007",
"url":"http://wangpan007.com/"
},
{
"type":"view",
"name":"搜百度云",
"url":"http://www.bdsola.com/"
},
{
"type":"view",
"name":"盘搜搜",
"url":"http://www.pansou.com/"
},{
"type":"view",
"name":"80s电影网",
"url":"https://m.80s.tw/"
}]
},
{
"name":"菜单",
"sub_button":[
{
"type":"view",
"name":"搜索",
"url":"http://www.soso.com/"
},
{
"type":"view",
"name":"视频",
"url":"http://v.qq.com/"
},
{
"type":"click",
"name":"赞一下我们",
"key":"V1001_GOOD"
}]
}]
}';
$params = array(
'http' => array(
'method' => 'POST',
'header'=> "Content-type: application/x-www-form-urlencoded\r\n"
. "Content-Length: ". strlen($menu) ."\r\n",
'content' => $menu
)
);
$ctx = stream_context_create($params);
echo file_get_contents($menuapi,false,$ctx);
$movieApi = "http://api.map.baidu.com/telematics/v3/movie?qt=hot_movie&location={$jd},{$wd}&output=json&ak=SnF72fxXpr2mAaS7FBMsyC4o07YbfMvk";
$hot_movie = file_get_contents($movieApi);
$hot_movie = json_decode($hot_movie,true)['result']['movie'];
print_r( $hot_movie );
foreach ( $hot_movie as $key => $value ) {
?>
<img src="<?php echo $hot_movie[$key]['movie_picture'] ?>">
<?php
}
$tapi = "https://openapi.youku.com/v2/searches/video/by_keyword.json?"; $mode = '&keyword=' . urlencode('夺路而逃'); $key = '&client_id=d36c06a0c14be911'; $url = $tapi . $mode . $key; $tapi = file_get_contents($url); $tapi = json_decode($tapi,true); print_r ($tapi);
微信菜单:
$appid = 'wx4621b6f3291a8800';
$appsecret = '5983fc4277b2fe470bab4fab18b938a1';
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
$res = file_get_contents($url);
$res = json_decode($res,true);
$access_token = $res['access_token'];
echo $access_token;
$menuapi = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$access_token}";
$menu = '{
"button":[
{
"name":"电影搜搜",
"sub_button":[
{
"type":"view",
"name":"网盘007",
"url":"http://wangpan007.com/"
},
{
"type":"view",
"name":"搜百度云",
"url":"http://www.bdsola.com/"
},
{
"type":"view",
"name":"盘搜搜",
"url":"http://www.pansou.com/"
},{
"type":"view",
"name":"80s电影网",
"url":"https://m.80s.tw/"
}]
},
{
"name":"菜单",
"sub_button":[
{
"type":"view",
"name":"搜索",
"url":"http://www.soso.com/"
},
{
"type":"view",
"name":"视频",
"url":"http://v.qq.com/"
},
{
"type":"click",
"name":"赞一下我们",
"key":"V1001_GOOD"
}]
}]
}';
$params = array(
'http' => array(
'method' => 'POST',
'header'=> "Content-type: application/x-www-form-urlencoded\r\n"
. "Content-Length: ". strlen($menu) ."\r\n",
'content' => $menu
)
);
$ctx = stream_context_create($params);
echo file_get_contents($menuapi,false,$ctx);
相关文章推荐
- java微信开发API解析(六)-综合运用(消息处理、自定义菜单响应处理、用户自动分组处理;包含源码)
- java微信开发API解析(四)-自定义菜单以及个性化菜单实现
- java微信开发API第四步 微信自定义个性化菜单实现
- 二十四:微信公众帐号开发-自定义菜单的创建及菜单事件响应
- Java微信二次开发之15-自定义菜单的类型
- 微信自定义菜单开发案例
- 微信开发-自定义菜单
- [039] 微信公众帐号开发教程第15篇-自定义菜单的view类型(访问网页)
- 微信开发创建自定义菜单报40054错误
- 微信开发之添加自定义3*5菜单
- 微信公众帐号开发教程第14篇-自定义菜单的创建及菜单事件响应
- 微信开发二三事:自定义菜单
- 微信公众帐号开发教程第14篇-自定义菜单的创建及菜单事件响应
- 二十五:微信公众帐号开发-自定义菜单的view类型(访问网页)
- 微信公众账号开发经验整理 ----- (1)自定义菜单
- 微信公众帐号开发教程第14篇-自定义菜单的创建及菜单事件响应
- 微信开发之添加自定义3*5菜单
- 微信服务号开发之创建自定义菜单
- 微信公众账号开发教程(四)自定义菜单(转)
- 微信公众帐号开发教程第15篇-自定义菜单的view类型(访问网页)