WeChat public platform Message Interface Development (28) Zhou Gongjie dream

Source: Internet
Author: User
Public platform development public platform developer public platform development mode weekly public solution interface API


1. obtain data

Fang times studio has developed an API for querying Zhou Gongjie dream. You are welcome to try it out.

The method is to directly submit the content name in the URL. the name must be urlencode first.
Call the url method: The following is a call to the Zhou Gongjie Meng method. the submitted content is "food"

http://api2.sinaapp.com/search/dream/?appkey=0020130430&appsecert=fa6095e113cd28fd&reqtype=text&keyword=%e9%a3%9f%e7%89%a9

The returned format is as follows:

{"Errcode": 0, "msgtype": "text", "text": {"content": "If you dream about a large amount of food, you will be discouraged. Dreaming that there is no food, it will make a lot of money. Women dream of a large amount of food, and the economy will be tight. "}}

A complete request is similar to the following:

If (substr ($ keyword,) = "dream") {$ entityName = trim (substr ($ keyword, 6, strlen ($ keyword ))); if ($ entityName = "") {$ contentStr = "Send" dream "with content, such as" Dream of first love ""; $ resultStr = $ this-> transmitText ($ object, $ contentStr, $ funcFlag); return $ resultStr ;}$ apihost = "http://api2.sinaapp.com /"; $ apimethod = "search/dream /? "; $ Apiparams = array ('appkey' =>" 0020130430 ", 'appcert' =>" fa6095e113cd28fd ", 'reqtype' =>" text "); $ apikeyword = "& keyword = ". urlencode ($ entityName); $ apicallurl = $ apihost. $ apimethod. http_build_query ($ apiparams ). $ apikeyword; $ api2str = file_get_contents ($ apicallurl); $ api2json = json_decode ($ api2str, true); $ contentStr = $ api2json ['text'] ['content']; $ resultStr = $ this-> transmitText ($ object, $ contentStr, $ funcFlag); return $ resultStr ;}

For the remaining code, see other articles in this blog. Http://www.cnblogs.com/txw1958/


2. Effect demonstration


III. trial account


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.