Use Fiddler to grab Android app packets and debug PHP programs

Source: Internet
Author: User
I have a need for this.

To debug the PHP program when the Android app launches a request to the server.

Break the target down, about the following steps

debugging PHP using Eclipse+xdebug, while XDEBUG triggering breakpoints requires the Get method to pass a parameter or set a cookie, I use a cookie method (I think this method is better)

That is, to find a way to get the app to launch a request with cookie information, because app development I am not familiar with, so can only think of other ways, my approach is to hook to the request, and then add the cookie value

Just fine, fiddler. In addition to the ability to crawl HTTP packets, he can modify requests and responses, and I need to modify the request.

There are two ways to modify a request using Fiddler, one is the next breakpoint, then the request header is modified, and the second is to write the script. I'm using the second method.

Add the Onbeforerequest method in the Fiddler script file

if (Osession.hostnameis ("192.168.1.7")) {
OSESSION.OREQUEST.HEADERS.ADD ("Cookie", "XDEBUG_SESSION=ECLIPSE_DBGP");
}

The meaning of this piece of code is

If the requested destination address is a picture of the 192.168.1.7 host, add a cookie, the key is Xdebug_session, and the value is ECLIPSE_DBGP, which is the cookie information I need when I use eclipse to trigger a power outage of PHP, so far, And my needs are fulfilled.


PS: If you debug PHP with Eclipse with Firefox, you can use a plugin called the easiest xdebug.


Reference: Http://www.cnblogs.com/tankxiao/archive/2012/04/25/2349049.html#ScriptEditCookie

Http://xdebug.org/docs/remote

Http://docs.telerik.com/fiddler/KnowledgeBase/FiddlerScript/ModifyRequestOrResponse

  • 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.