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
Parameter Description
ToUserName 接收方帐号(收到的OpenID) FromUserName 开发者微信号 CreateTime 消息创建时间 MsgType music MusicUrl 音乐链接 HQMusicUrl 高质量音乐链接,WIFI环境优先使用该链接播放音乐 FuncFlag 位0x0001被标志时,星标刚收到的消息。
3. Core program implementation
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
This is the display at the top sidebar
This is the music playback interface
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!