> For the complete documentation index, see [llms.txt](https://docs.ipwo.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipwo.net/kai-fa-zhe-wen-dang/dai-ma-shi-li/curl-dai-ma-shi-li.md).

# cURL 代码示例

cURL 是最常用的代理调试工具之一，推荐开发者在正式接入前先使用 curl 测试代理是否正常。

适用于：

* 检测代理是否生效
* 查看出口 IP
* 检查国家地区
* 排查连接问题

***

## 一、HTTP 代理测试

```
curl -x http://us.ipwo.net:7878 -U username_custom_zone_us:password http://ipinfo.io
```

***

## 二、SOCKS5 代理测试

```
curl -x socks5://us.ipwo.net:7878 -U username_custom_zone_us:password http://ipinfo.io
```

***

## 三、正常返回示例

```json
{
  "ip": "203.0.113.10",
  "city": "Los Angeles",
  "country": "US"
}
```

如果返回的 IP：

* 不是本机公网 IP
* 国家地区正确

说明代理已经生效。

***

## 四、获取当前出口 IP

```
curl -x http://us.ipwo.net:7878 -U username_custom_zone_us:password http://api.ipify.org
```

返回示例：

```
203.0.113.10
```

***

## 五、测试 IP 是否轮换

连续执行：

```
curl -x http://us.ipwo.net:7878 -U username_custom_zone_us:password http://api.ipify.org
```

* IP 变化：说明为轮换 IP
* IP 不变：说明可能为粘性会话

***

## 六、固定 Session（粘性 IP）

适用于：

* [TikTok](/ying-yong-chang-jing/tiktok-yun-ying.md)
* [Facebook](/ying-yong-chang-jing/facebook-guang-gao.md)
* [Amazon](/ying-yong-chang-jing/amazon-dian-pu-guan-li.md)
* 多账号环境

示例：

```
curl -x http://us.ipwo.net:7878 -U username_custom_zone_us_session_abc123:password http://ipinfo.io
```

相同 Session 通常会保持同一个 IP。

***

## 七、查看详细调试日志

开发者排查问题时推荐使用：

```
curl -v -x http://us.ipwo.net:7878 -U username_custom_zone_us:password http://ipinfo.io
```

可用于排查：

* [407 错误](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/407-proxy-authentication-required.md)
* [超时 Timeout](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/chao-shi-timeout.md)
* [DNS 错误](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/dns-jie-xi-shi-bai.md)
* [SSL 错误](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/ssl-zheng-shu-cuo-wu.md)

***

## 八、Windows 用户注意事项

Windows CMD / PowerShell 建议：

```
用户名密码包含特殊字符时建议使用双引号
```

例如：

```
curl -x "http://us.ipwo.net:7878" -U "username_custom_zone_us:password" http://ipinfo.io
```

***

## 九、推荐开发者调试流程

```
1. curl 测试代理
↓
2. 检查 IP 是否变化
↓
3. 检查国家地区
↓
4. 再接入代码
```

***

## 十、相关文章

* [如何检测代理是否生效](/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jian-ce-dai-li-shi-fou-sheng-xiao.md)
* [如何检测 IP 地区](/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jian-ce-ip-di-qu.md)
* [什么是粘性会话](/dai-li-ji-chu-zhi-shi/shen-me-shi-nian-xing-hui-hua.md)
* [什么是轮换 IP](/dai-li-ji-chu-zhi-shi/shen-me-shi-lun-huan-ip.md)
* [HTTP 与 SOCKS5 区别](/dai-li-ji-chu-zhi-shi/http-yu-socks5-qu-bie.md)
* [407 Proxy Authentication Required](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/407-proxy-authentication-required.md)
* [超时 Timeout](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/chao-shi-timeout.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ipwo.net/kai-fa-zhe-wen-dang/dai-ma-shi-li/curl-dai-ma-shi-li.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
