احتراف استخدام cURL مع البروكسي: دليل المطورين

في عالم الخوادم، لا توجد متصفحات. أداة curl هي صديقك المفضل لفحص الاتصال. سواء كنت تحاول الوصول لخدمة خلف جدار حماية أو تفحص رؤوس الاستجابة، فهم خيارات البروكسي في cURL أمر إلزامي.

الأمر الأساسي (The -x Flag)

الخيار -x (أو --proxy) هو المفتاح.


# Basic HTTP Proxy
curl -x http://10.10.1.10:3128 http://example.com

# Proxy with Authentication
curl -x http://user:pass@10.10.1.10:3128 http://example.com

# SOCKS5 Proxy (Common for Tor/SSH)
curl -x socks5://127.0.0.1:9050 http://check.torproject.org
                    

تجاهل أخطاء الشهادات (-k)

عند استخدام Man-in-the-Middle Proxy لفحص التشفير، ستواجه أخطاء SSL. استخدم -k أو --insecure لتجاهل هذه الأخطاء وإكمال الطلب.
curl -k -x http://localhost:8888 https://google.com

تتبع التفاصيل (-v)

لفهم عملية المصافحة (Handshake) مع البروكسي، استخدم الوضع التفصيلي (Verbose):
curl -v -x http://proxy.com:8080 http://example.com
ستري سطوراً تبدأ بـ CONNECT وهي توضح كيف يقوم cURL بطلب نفق اتصال آمن من البروكسي.

متغيرات البيئة (Environment Variables)

بدلاً من كتابة البروكسي كل مرة، يمكنك ضبطه في الـ Shell:
export http_proxy="http://proxy:port"
cURL والعديد من الأدوات الأخرى ستحترم هذا المتغير تلقائياً.

Disclosure: we may earn a commission if you purchase through some links.

Services Related To This Article

These offers are related to privacy, password security, and development workflows. Replace the current links with your real affiliate links through environment variables.

Default Links Need Replacement

Proton

Privacy, mail, and VPN

A strong fit for privacy-focused visitors who want VPN and secure email under one brand.

Explore Proton

Surfshark

Consumer VPN

Best on pages about geo-blocking, privacy, and public Wi-Fi protection.

Try Surfshark

NordVPN

High-converting VPN

A clear offer for users who need a paid, more durable alternative to a free proxy.

View NordVPN

1Password

Password management

The best match for password, secrets, team access, and personal security pages.

Discover 1Password

DigitalOcean

Developer cloud hosting

A strong fit for proxy setup, server, and infrastructure content aimed at developers and small teams.

Start with DigitalOcean