Home  >  Article  >  WeChat Applet  >  WeChat public platform message interface development for online song request/online music

WeChat public platform message interface development for online song request/online music

高洛峰
高洛峰Original
2017-03-04 11:16:522131browse

1. Obtain music resources

Baidu has a music interface,

http://box.zhangmen.baidu.com/x?op =12&count=1&title=About winter$$Qiqin$$$$

The returned result is

This XML file does not appear to have any style information associated with it. The document tree is shown below.<result><count>1</count><url><encode></encode><decode></decode><type>8</type><lrcid>14706</lrcid><flag>1</flag></url><durl><encode></encode><decode></decode><type>8</type><lrcid>14706</lrcid><flag>1</flag></durl><p2p><hash>d1cae9f7634c5aa3d54d7b1b1ad4c5b79b6e97ff</hash><url></url><type>mp3</type><size>5710896</size><bitrate>192</bitrate></p2p></result>

2. Connecting with WeChat

The music message format is as follows

WeChat public platform message interface development for online song request/online music

Parameter Description

ToUserName  接收方帐号(收到的OpenID)
FromUserName  开发者微信号
CreateTime  消息创建时间
MsgType  music
MusicUrl  音乐链接
HQMusicUrl  高质量音乐链接,WIFI环境优先使用该链接播放音乐
FuncFlag  位0x0001被标志时,星标刚收到的消息。

3. Core program implementation

WeChat public platform message interface development for online song request/online music

4. Effect Demonstration
You need to add the WeChat public account Fangbei Studio, you can see the relevant instructions

<span style="color: #000000;">1. 发送“点歌”加歌名,如“点歌最炫民族风”,返回指定的歌曲。<br></span>

The song plays smoothly in the WIFI environment and has a good experience.

This is the interface for successfully requesting songs

WeChat public platform message interface development for online song request/online music

This is the display at the top sidebar

WeChat public platform message interface development for online song request/online music

This is the music playback interface

WeChat public platform message interface development for online song request/online music

More WeChat public platform news For articles related to interface development and online song request/online music, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn