Curl + Charles

As this blog post, when using Charles for debugging requests done by cURL:

When using libCurl (programmatically):

Set CURLOPT_PROXY and CURLOPT_PROXYPORT as below:
curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1");
curl_setopt($ch, CURLOPT_PROXYPORT, 8888);

// And to avoid certificate trust errors...
// WARNING: Do not use this in production environments
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

When using curl from the terminal

Option --proxy or its short for -x can be used
curl --proxy 127.0.0.1:8888 'http://my.host.com/api/path?param=value'
For example:
curl \
  -X GET \
  -H 'Authorization: Basic MYTOKEN' \
  --proxy '127.0.0.1:8888' \
  -v \
  'http://my.host.com/api/path?param=value'

0 comments :

This work is licensed under BSD Zero Clause License | nacho4d ®