performing HTTP requests with cURL (using PROXY)
General way:
export http_proxy=http://your.proxy.server:port/
Then you can connect through proxy from (many) application.
And, as per comment below, for https:
export https_proxy=https://your.proxy.server:port/
curl through proxy syntax
Ignore "["
when reading general syntax. Also, windows likes double vs single quotes.
So the command is:
curl -x my-host-which-i-know:my-port-which-i-know -U my-username-which-i-know:my-pass-which-i-know http://www.google.com
How do I make curl ignore the proxy?
I assume curl is reading the proxy address from the environment variable http_proxy
and that the variable should keep its value. Then in a shell like bash, export http_proxy='';
before a command (or in a shell script) would temporarily change its value.
(See curl's manual for all the variables it looks at, under the ENVIRONMENT
heading.)
curl HTTPS via an SSH proxy
Try using a socks5
proxy for example:
$ ssh -D 8080 -f -C -q -N user@remote.host
- -D 8080 tells ssh to launch a SOCKS server on port 8080 locally.
- -f Forks the process to the background.
- -C Compresses the data before sending it.
- -q Uses quiet mode.
- -N Tells SSH that no command will be sent once the tunnel is up.
Then you could use curl
like this:
curl -x socks5h://0:8080 https://example.com
Related Topics
PHP Sort Array by Two Field Values
How to Show Multiple Recaptchas on a Single Page
PHP: Access Array Value on the Fly
How to Get Const'S Defined on a PHP Class
Check If a User/Guest Has Purchased Specific Products in Woocommerce
How to Create an Error 404 Page Using PHP
How to Login in With Curl and Ssl and Cookies
$_Post Vs. $_Server['Request_Method'] == 'Post'
PHP Returning Json to Jquery Ajax Call
How to List All Months Between Two Dates
Creating PHP Class Instance With a String
Is It Safe to Trust $_Server['Remote_Addr']
How to Remove All Specific Characters At the End of a String in PHP
How to Pass Variable Number of Arguments to a PHP Function
Why Is Using a MySQL Prepared Statement More Secure Than Using the Common Escape Functions