Use fiddler to capture Android APP data packets and Debug PHP programs

Source: Internet
Author: User
I need to use fiddler to capture Android APP data packets and Debug PHP programs.

You need to debug the PHP program when the Android APP initiates a request to the server.

To split the target, follow these steps:

Debugging PHP using ECLIPSE + XDEBUG, while XDEBUG requires the get method to pass a parameter or set a COOKIE to trigger the breakpoint. I use the COOKIE method (I think this method is better)

That is to say, we need to find a way to enable the APP to carry COOKIE information when initiating a request. because I am not familiar with APP development, we can only find another way. my approach is to HOOK the request and then add the COOKIE value.

In addition to the ability to capture HTTP packets, fiddler can also modify requests and responses. what I need to modify is the request.

You can use fiddler to modify a request in either of the following ways: breakpoint, request header modification, or script writing. I used the second method.

Add the OnBeforeRequest method in the script file of fiddler

If (oSession. HostnameIs ("192.168.1.7 ")){
OSession. oRequest. headers. Add ("Cookie", "XDEBUG_SESSION = ECLIPSE_DBGP ");
}

This code indicates that

If the target address of the request is 192.168.1.7, add a COOKIE with the key XDEBUG_SESSION and the value ECLIPSE_DBGP. this is the COOKIE information required when I use eclipse to trigger PHP power-off, so far, my requirements have been met.


PS: If you use Firefox debugging and ECLIPSE to Debug php, you can use a plug-in called the easiest xdebug.


References: 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.