WeChat/ public platform development (4): public account debugger (simulate WeChat platform, provide PHP source code)

Source: Internet
Author: User
/public platform development (4): Debugging is often troublesome when the public code debugger (simulation platform, PHP source code) is developed/The  public platform, generally, you can only try it on your phone or write logs on the server. When your server script has a Bug, it is not displayed on your mobile phone, and tracing is not easy. During the development process, I wrote a debugger that can be used to develop a public/ platform (4): Public code debugger (simulation platform, PHP source code)


Debugging is often very troublesome when developing or writing logs on the public platforms of  When your server script has a Bug, it is not displayed on your mobile phone, and tracing is not easy. During the development process, I wrote a debugger to simulate/ platform, access the public account URL, and display detailed response data. it became easy to debug the public account. We will share it with you.


Debugger address: http://www.jostudio.org/emulator.php


The interface is as follows: enter the public account URL to send a text message, and the response data is displayed. Development and debugging.


 


The debugger can send text information, enter the text content, and press "send text message.

The debugger can also click the simulation menu, enter the EventKey value of the menu, and press "click menu.

The debugger can also simulate user attention and press the "start from scratch" key. at this time, the debugger will send a subscribe message to the public account URL.


If an error occurs during the response to the public account URL, it will also be displayed in the returned data. debugging is useful!


Note: When the debugger sends a message to the public account URL, the sender's openid is "emulator_user"



Mysterious function: This debugger can access any URL, just like a web proxy. for example, it shows access to www.baidu.com and click "Start from scratch" to view the returned data.

Why are Chinese characters of returned data garbled? This is because baidu.com returns gbk-encoded Chinese characters, while the debugger follows the platform rules and uses UTF-8-encoded Chinese characters. check the "return data is GBK encoding" option and click "Start from scratch" to submit again. The Chinese characters in the returned results will not be garbled.




Check "the returned data is GBK encoding" and click "Start from scratch" to access www.baidu.com again. The result shows "the webpage does not exist." Why? This is because the debugger follows the platform rules and automatically adds a signature value after the URL and accesses the URL in POST mode. Therefore, Baidu considers that the URL does not exist.


Check the "access URL by GET" option, and do not check "return data is GBK encoding". click "Start from scratch" to access www.baidu.com again. this time is normal.

PS: Baidu homepage is UTF-8 encoded, but the error page is gbk encoded


Note: The above process is an experiment for accessing other websites. when debugging the public account URL, do not select "access URL in GET mode" or "return data is GBK encoding ".


Hey hey, let's take a look at www.facebook.com. the webpage will be available soon, saying you can access any URL, isn't it? Is this a wall ?! Right!

(Sorry, the debugger only reads and displays the webpage, and does not complete the web proxy function, so you cannot log on to facebook)






If you are interested in the debugger source code, you can download the debugger source code from my resources.


The source code has only one file, emulator. php, which can be installed on your own server.


Don't Explain. let's look at the source code comments.





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.