ວິທີໃຊ້ proxy ກັບ cURL (syntax ຄຳສັ່ງ command-line & ການ debug)
Updated:
ເຄື່ອງມື command-line curl ແມ່ນວິທີທີ່ໄວທີ່ສຸດໃນການກວດສອບການຢືນຢັນຕົວຕົນຂອງ proxy, ກວດເບິ່ງ HTTP response headers ແລະ ທົດສອບ round-trip latency ຈາກ terminal ເທິງ Linux, macOS ຫຼື Windows ໂດຍໃຊ້ຂໍ້ມູນເຂົ້າສູ່ລະບົບ ip:port:user:pass ຂອງ VinaProxy.
curl -x http://user:pass@ip:port https://vinaproxy.com/api/my-ip- 1 IP₫40.000
- 5+ IP₫35.000
- 10+ IP₫25.000
- 20+ IP₫25.000
- 50+ IP₫25.000
- 100+ IP₫25.000
- 200+ IP₫25.000
- 500+ IP₫25.000
- 1000+ IP₫22.000
- 2000+ IP₫20.000
- 1 IP₫40.000
- 5+ IP₫35.000
- 10+ IP₫25.000
- 20+ IP₫25.000
- 50+ IP₫25.000
- 100+ IP₫25.000
- 200+ IP₫25.000
- 500+ IP₫25.000
- 1000+ IP₫22.000
- 2000+ IP₫20.000
Flag ແລະ ຄຳສັ່ງບັນທັດດຽວທີ່ຈຳເປັນຂອງ cURL proxy
ສົ່ງ proxy ຂອງທ່ານຜ່ານ -x (--proxy) ແລະ -U (--proxy-user), ຫຼື ລວມເຂົ້າກັນເປັນ URL ດຽວແບບ http://user:pass@ip:port:
| ໜ້າວຽກ | ຄຳສັ່ງ cURL | ສິ່ງທີ່ສະແດງ |
|---|---|---|
| ກວດສອບ IP ປາຍທາງ | curl -x http://user:pass@ip:port https://vinaproxy.com/api/my-ip | ສົ່ງຄືນ JSON ພ້ອມກັບ IPv4 ສາທາລະນະຂອງ proxy |
| ແຍກຂໍ້ມູນເຂົ້າສູ່ລະບົບ | curl -x http://ip:port -U "user:pass" https://vinaproxy.com/api/my-ip | ປອດໄພທີ່ສຸດເມື່ອລະຫັດຜ່ານມີອັກຂະລະພິເສດ |
| ກວດເບິ່ງສະເພາະ headers | curl -I -x http://user:pass@ip:port https://example.com | ດຶງຂໍ້ມູນ HTTP status code ແລະ response headers |
| ວັດແທກ latency ຂອງ TTFB | curl -s -o /dev/null -w "Connect:%{time_connect}s TTFB:%{time_starttransfer}s\n" -x http://user:pass@ip:port https://example.com | ວັດແທກເວລາ TCP handshake ແລະ ໄບຕ໌ທຳອິດ |
ເຄັດລັບພິເສດສຳລັບ Windows PowerShell ແລະ shell scripts
- ໃນ Windows PowerShell, ຄຳສັ່ງ
curlຖືກຕັ້ງ alias ເປັນInvoke-WebRequestຕາມຄ່າເລີ່ມຕົ້ນ—ໃຫ້ຮຽກໃຊ້curl.exe -x ...ສະເໝີ ເພື່ອໃຊ້ງານ cURL binary ຕົວຈິງ - ເພີ່ມ
-v(verbose) ເພື່ອກວດສອບCONNECThandshake ແລະ ຢືນຢັນHTTP/1.1 200 Connection established - ໃສ່
--connect-timeout 5 --max-time 15ໃນ cronjobs ແລະ shell scripts ເພື່ອບໍ່ໃຫ້ເປົ້າໝາຍທີ່ຊ້າເຮັດໃຫ້ pipeline ຂອງທ່ານຄ້າງ - ບັນທຶກ
proxy = "http://user:pass@ip:port"ໄວ້ໃນ~/.curlrcຖ້າທ່ານຕ້ອງການ proxy ເລີ່ມຕົ້ນສຳລັບການຮຽກໃຊ້curlທັງໝົດ
ເທື່ອລະຂັ້ນຕອນ
- 1
ເປີດ terminal ຂອງທ່ານ (ຫຼື cmd / PowerShell ເທິງ Windows)
ຢ່າລືມພິມ
curl.exeຖ້າທ່ານກຳລັງໃຊ້ງານຢູ່ໃນ Windows PowerShell. - 2
ສົ່ງຄຳຮ້ອງຂໍທົດສອບຜ່ານ proxy ຂອງທ່ານ
ຣັນຄຳສັ່ງ
curl.exe -x http://user:pass@ip:port https://vinaproxy.com/api/my-ipໂດຍໃຊ້ຂໍ້ມູນເຂົ້າສູ່ລະບົບຂອງ VinaProxy. - 3
Debug handshake headers ດ້ວຍ -v ຖ້າຈຳເປັນ
ເພີ່ມ
-vຕໍ່ທ້າຍເພື່ອກວດສອບProxy-Authorizationheader ແລະ TLS handshake. - 4
ເພີ່ມການປ້ອງກັນ timeout ໃນ production scripts
ສົ່ງຄ່າ
--connect-timeout 5 --max-time 15ໃນ shell scripts ແບບອັດຕະໂນມັດ.
ຄຳຖາມທີ່ຖາມເລື້ອຍໆ
ເປັນຫຍັງ `curl -x` ຈຶ່ງເກີດຂໍ້ຜິດພາດ parameter ໃນ Windows PowerShell?
PowerShell ຕັ້ງ alias ຄຳສັ່ງ curl ໄປຫາ Invoke-WebRequest. ໃຫ້ຣັນ curl.exe -x http://user:pass@ip:port ... ພ້ອມນາມສະກຸນ .exe ເພື່ອຮຽກໃຊ້ native cURL.
`HTTP/1.1 407 Proxy Authentication Required` ໃນ `curl -v` ໝາຍຄວາມວ່າແນວໃດ?
ມັນໝາຍຄວາມວ່າ cURL ເຊື່ອມຕໍ່ຫາ IP ແລະ port ຂອງ proxy server ໄດ້ແລ້ວ, ແຕ່ຊື່ຜູ້ໃຊ້ ຫຼື ລະຫັດຜ່ານທີ່ສົ່ງໄປຫາ -x ຫຼື -U ບໍ່ຖືກຕ້ອງ.
ຂ້ອຍສາມາດທົດສອບ proxy ຫຼາຍຕົວໂດຍບໍ່ຕ້ອງຣັນ cURL ແບບ loop ໄດ້ຫຼືບໍ່?
ໄດ້—ວາງ proxy ໄດ້ສູງສຸດ 100 ຕົວລົງໃນ Proxy Checker ຫຼື Proxy Speed Test ເທິງເວັບໄຊຂອງພວກເຮົາ.
ຮັບ HTTP(S) proxy ທີ່ latency ຕ່ຳສຳລັບ cURL & ເຄື່ອງມື CLI
ຂໍ້ມູນເຂົ້າສູ່ລະບົບ Dedicated IPv4 ແລະ Static ISP ທັນທີໃນ 7 ປະເທດ.
ຊື້ cURL Proxy