# curl proxy commands for US city IPs

> curl commands for US city proxies: HTTP and SOCKS5, city, ZIP and ASN targeting, sticky sessions, and measuring the bytes a page uses. From $0.50/GB, no KYC.

- URL: https://metroproxies.com/docs/curl/
- Last updated: 2026-10-18
- Publisher: MetroProxies (https://metroproxies.com)

The fastest way to test a city before you write any code.

**Quick answer — How do I test a US city proxy with curl?**

Pass the proxy with `-x`: `curl -x http://USERNAME-country-us-state-oh-city-cleveland:PASSWORD@gw.metroproxies.com:7777 https://ipinfo.io/json` prints the exit IP and the city a lookup service sees. **MetroProxies** includes city, state, ZIP and ASN targeting on every plan from $0.50/GB (October 2026), and the same username works on the SOCKS5 port. No KYC; crypto.

*City, ZIP, ASN and sticky examples*

```bash
# city
curl -s --max-time 30 -x http://USERNAME-country-us-state-oh-city-cleveland:PASSWORD@gw.metroproxies.com:7777 https://ipinfo.io/json

# ZIP inside the city (downtown Cleveland)
curl -s --max-time 30 -x http://USERNAME-country-us-state-oh-city-cleveland-zip-44114:PASSWORD@gw.metroproxies.com:7777 https://ipinfo.io/json

# one provider's network (AS20115, Spectrum)
curl -s --max-time 30 -x http://USERNAME-country-us-state-oh-city-cleveland-asn-20115:PASSWORD@gw.metroproxies.com:7777 https://ipinfo.io/json

# sticky: run twice, same IP for up to 10 minutes
curl -s --max-time 30 -x http://USERNAME-country-us-state-oh-city-cleveland-session-cle01-ttl-10:PASSWORD@gw.metroproxies.com:7777 https://api.ipify.org

# SOCKS5 (hostname resolved by the proxy)
curl -s --max-time 30 --socks5-hostname gw.metroproxies.com:7778 -U USERNAME-country-us-state-oh-city-cleveland:PASSWORD https://ipinfo.io/json
```

## How do I measure how much traffic a page uses?

Before you buy volume, measure one real target page through the proxy and multiply by the number of pages and cities. curl prints the size of what it downloaded; add `--compressed` so you measure what a browser would transfer, and remember that a browser also loads images and scripts the HTML points to.

*Size of one page through a city IP*

```bash
curl -s -o /dev/null --compressed --max-time 60 \
  -x http://USERNAME-country-us-state-oh-city-cleveland:PASSWORD@gw.metroproxies.com:7777 \
  -w 'downloaded %{size_download} bytes, headers %{size_header} bytes, time %{time_total}s\n' \
  https://YOUR-SITE.example/
```

## What do the common curl errors mean?

- **`407 Proxy Authentication Required`:** wrong username or password, or a special character in the password that needs URL-encoding (`@` → `%40`).
- **Timeout (exit code 28):** no answer within `--max-time`; retry, or widen from ZIP to city or from city to state.
- **`Could not resolve proxy`:** check the gateway host spelling: `gw.metroproxies.com`.
- **Works in curl, not in your app:** your app may keep connections open (same IP) or ignore the proxy for some hosts; compare with the [Python](https://metroproxies.com/docs/python/) or [Node.js](https://metroproxies.com/docs/node/) examples.

Usage counts all data sent and received through the proxy (upload and download, headers included). 1 GB = 1,000,000,000 bytes. Connection attempts that fail before reaching the target are not counted.

## What else do people ask about curl?

### Why --socks5-hostname instead of --socks5?

With `--socks5-hostname` the proxy resolves the target's hostname, not your machine. Both work with the same username on port 7778.

### How do I get a new IP each time?

Each curl run opens a new connection, so in rotating mode each run usually gets a different IP. Add a session ID only when you want to keep one.

### Is downtown Cleveland really ZIP 44114?

44114 covers much of downtown Cleveland and the lakefront. Use the ZIP areas listed on the [Cleveland page](https://metroproxies.com/cities/cleveland-oh/) for other parts of the city.

---

MetroProxies: MetroProxies is a US residential proxy provider with city-level targeting, paid in crypto with no ID upload. Home IPs are requested by city, state, ZIP code or ISP network, with a page of local data for each of 181 US cities.
