← back to blog

Curl mobile proxy testing: every pattern that matters

Prove it works before you write any code

Before you write a single line of scraper code, prove the proxy works with curl. One line, 2 flags, and you should see a real Singapore mobile IP echoing back at you. If you can’t get curl working against a mobile gateway, no library is going to save you later. Here’s every curl pattern that matters when you’re working with mobile proxies.

curl is the universal HTTP command line client. It ships on every Linux box, every Mac, modern Windows, and inside almost every CI image you’ll ever touch. For mobile proxy work, it’s the fastest debugging tool you have. By the end of this article, you’ll know how to send GET and POST requests, switch to SOCKS5, persist cookies across sessions, time requests, retry on failure, and pipe output straight into jq.

This breaks into three parts. First, basic GET and POST requests over HTTP and SOCKS5. Second, sticky sessions and cookie persistence. Third, the debugging tricks and jq pipelines that turn curl into a working CLI scraper.

The basics: GET and POST

The simplest curl request through a Singapore mobile gateway uses two flags: -x to set the proxy, and -U to provide credentials.

curl -x gw.example.com:1000 -U user:pass https://api.ipify.org

If your username has special characters, embed the credentials directly in the proxy URL instead of using -U. curl handles URL-encoding of the password automatically, so you don’t need to escape it by hand.

Switching to SOCKS5

If your provider exposes a SOCKS5 endpoint, just change the scheme, but use socks5h, not socks5. The h means DNS resolution happens through the proxy instead of locally.

curl -x socks5h://gw.example.com:1080 -U user:pass https://api.ipify.org

Plain socks5 resolves DNS on your own machine, which leaks your real DNS queries to your ISP even though the HTTP traffic goes through the proxy. Always use socks5h for mobile proxy work.

POST with a JSON body

POST works the same way, just add -X POST for the method and -d for the body. Use -H for any extra headers you need.

curl -x gw.example.com:1000 -U user:pass \
  -X POST -H "Content-Type: application/json" \
  -d '{"query":"test"}' https://api.example.com/endpoint

This one pattern covers 90 percent of the API testing you’ll do through a mobile proxy.

Mobile user agent and Singapore locale

If you want traffic that looks like it’s coming from a real Singapore phone, layer in a mobile user agent, a Singapore locale header, and client hints on top of the request.

curl -x gw.example.com:1000 -U user:pass \
  -H "User-Agent: Mozilla/5.0 (Linux; Android 13)" \
  -H "Accept-Language: en-SG" \
  https://api.ipify.org

User agent, Accept-Language, and client hints, all aligned with the mobile IP, is what a normal Singapore consumer’s traffic looks like.

For account-bound work, bake a session token into the proxy username, then use -c to write cookies and -b to read them back.

curl -x gw.example.com:1000 -U user-session123:pass \
  -c cookies.txt -b cookies.txt https://example.com/login

-c writes cookies to a file, -b reads them from the same file, and it’s the same file both ways. That means you can resume a session on the next run with the same IP and the same cookies, giving you clean continuity between requests.

The health-check loop

Before kicking off any longer scrape job, prove that every port you’re about to use is actually up. This is the single most useful curl pattern for mobile proxy work.

for port in 1000 1001 1002; do
  curl -s -x gw.example.com:$port -U user:pass \
    --max-time 5 https://api.ipify.org
done

Run this before any longer job. It catches a dead port in 5 seconds instead of an hour into a crawl.

Timing the connection

For latency-sensitive work, curl’s --write-out option gives you per-stage timing on the request.

curl -x gw.example.com:1000 -U user:pass \
  -w "connect: %{time_connect} ttfb: %{time_starttransfer}\n" \
  -o /dev/null -s https://api.ipify.org

Singapore mobile proxies hitting Singapore targets typically show a time to first byte of 100 to 300 milliseconds. Anything above 1 second means either the proxy or the target is unhealthy.

Verbose output for debugging

When something fails, add -v for verbose output. curl will print every TCP connect, every TLS handshake, and every header going both directions.

For deeper debugging, --trace-ascii captures every byte of the conversation, including the encrypted TLS payload in plaintext. It’s invaluable when a proxy is misbehaving and you need to see exactly what’s happening on the wire.

Handling 429 with retries

curl 7.71 and newer has built-in retry support: --retry, --retry-delay, and --retry-on-error.

curl -x gw.example.com:1000 -U user:pass \
  --retry 3 --retry-delay 2 --retry-on-error \
  https://api.example.com/endpoint

For proper exponential backoff, write a small wrapper script instead. 5 attempts, doubling the sleep time between each one, is about 10 lines of bash and doesn’t need any library at all.

Piping to jq

curl, jq, and mobile proxies together make for a genuinely useful CLI scraping pipeline.

curl -s -x gw.example.com:1000 -U user:pass \
  https://api.example.com/data | jq '.results[]'

Save the output to a file and process it later with jq. There’s no need to install a single Python or Node dependency for a lot of quick scrape jobs.

The cheat sheet

A quick reminder of the flags you’ll reach for most: -x sets the proxy. -U handles proxy auth. -H adds headers. -d sends a body. -b and -c read and write cookies. -v gives verbose output. -w prints timing. --max-time bounds a stalled request. --retry covers transient failures. -k skips TLS verification, but only ever use that for debugging.

Production gotchas

Never commit credentials to a repo, always use environment variables instead. Always set --max-time so a stalled request can’t hang your script forever. For production scrape loops, switch to a real client library, because connection reuse matters once you’re operating at scale. curl is the right tool for one-off requests, debugging, and testing, not for a long-running production crawler.

If you want to test these one-liners against real Singapore SingTel, StarHub, and M1 IPs, head over to Singapore Mobile Proxy and grab a trial. Use code YT30 for 30 percent off your first month, drop the gateway hostname into any snippet above, and you’re already shipping.

Get new guides and videos first — join the Telegram channel.

ready to try Singapore mobile proxies?

24-hour free trial. no credit card required.

start free trial
message me on telegram