What is Curl? curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.
Using a proxy to connect. Very handy if you are working on the DMZ server where you need to connect to the external world using a proxy. Curl -proxy yourproxy:port Test URL with injecting header. You can use curl by inserting a header with your data to test or troubleshoot the particular issue.
So in the cloud you may find yourself on a server that needs to communicate to an external system but it isn’t allowed to go there directly. In which case you will most likely have a proxy server to communicate through. In PeopleSoft you can define a web gateway proxy server, however, to test to make sure that the server is working correctly with the proxy you will want to do a curl test.
Linux Command Prompt –> curl http://whatsmyip.com
This should return the external IP address of the system you are coming out of. If this returns nothing you are likely blocked from going to that address. So to push the request through the proxy server, you need to set the proxy in an environment variable:
Linux Command Prompt –> export http_proxy=http://myproxy.atmyserver.com:80
Linux Command Prompt –> curl http://whatsmyip.com
Now as long as the proxy is allowed to communicate to that address you should see the IP address of the system you are communicating from.
This post will guide you how to use CURL command to access HTTP or HTTPS website with a proxy server in Linux system. How do I Set Proxy for Curl Command in Linux.
If you want to user a proxy for a Linux command, and you need to set the environment variables http_proxy or https_proxy. And those two proxy variables are used by the most of all Linux command with proxy. such as: curl, wget, ssh, apt-get, yum and so on.
You need to export those variables in your bash shell, type:
If your proxy server need to use the username and password, you can type the following command to export Proxy variables:
After exporting those variables, the curl command will perform the HTTP/HTTPS requests using the above proxy setting.
Or you can also pass all proxy setting to curl command, just use the -x option, just like below:
If you password contains special characters, you need to replace them with ASCII codes.
If you want to diable proxy setting for your current server or your curl command, you can type the following commands: