In the world of app development and testing, understanding the data traffic is vital. Charles Proxy stands out as a versatile tool, enabling users to view all HTTP and SSL/HTTPS traffic from their devices to the internet. This article walks you through setting up Charles Proxy on any PC to monitor API calls from an iPhone app.
Prerequisites
- A PC with Charles Proxy installed.
- An iPhone.
- Both devices connected to the same network.
Step-by-Step Guide
1. Set Up Charles Proxy on Your PC
- Begin by downloading and installing Charles Proxy on your PC.
- Once installed, launch Charles Proxy.
- Head to Proxy > Proxy Settings. Here, make note of the port number (usually 8888).
2. Configure Your iPhone’s Wi-Fi settings
- On your iPhone, go to Settings > Wi-Fi.
- Tap the information icon (i) next to the Wi-Fi network you’re connected to.
- Scroll down to the 'Configure Proxy' option and select 'Manual'.
- For the server, enter the IP address of your PC. For the port, input the one noted from Charles (usually 8888).
- Save the settings.
3. Start Recording in Charles
- On your PC, inside Charles Proxy, click the record button. This will begin the session capture.
4. Trust the Charles SSL Certificate
For full visibility into SSL encrypted networks (https):
- On the iPhone, open Safari and visit chls.pro/ssl to download the Charles SSL certificate.
- Go to Settings > General > Profile on your iPhone and trust the Charles Proxy certificate.
- Then, navigate to Settings > General > About > Certificate Trust Settings and toggle on the Charles Proxy certificate.
5. Monitor API Calls
- Now, use your iPhone app as you normally would.
- All the API calls, both incoming and outgoing, will be visible in Charles Proxy on your PC. This allows for in-depth analysis, including checking headers, content, and response times.
6. Analyzing the Data
- In Charles Proxy, you'll see a list of domains. Click on any of them to see the list of paths.
- Clicking on individual paths will provide detailed information about the request and response, including headers, query parameters, response body, and more.
7. Stop Recording and Revert Settings
- When done, click the stop button in Charles Proxy to halt recording.
- It's also advisable to revert the Wi-Fi proxy settings on your iPhone back to 'Off' to resume normal internet usage.
Conclusion
Charles Proxy is an invaluable tool for developers, testers, and even curious users, offering insights into the intricacies of app data traffic. By following this guide, you can seamlessly set up Charles on any PC and start analyzing API calls from your iPhone app. Happy debugging!