
In order to do a cURL on an IP address instead of a domain name or hostname, you can make use of the IP address instead.
curl http://xx.xx.xx.xx/sub-directory/
Example 1: IPv4 with default port 80:
$ curl http://127.0.0.1/tutorials/
The above example, will cURL to default port 80 and connect to the IP of localhost i.e. 127.0.0.1
In order to cURL to an IPv6 address, you will need to provide the IPv6 address inside square brackets,
Example 2: IPv6 with default port 80:
$ curl http://[::1]/tutorials/
Again the above will connect to the localhost at port 80.
Let's see some examples with a non-custom port like 8080,
Example 3: IPv4 with port 8080$ curl http://192.168.1.125:8080/tutorials/
Example 4: IPv6 with port 8090
$ curl http://[::ffff:c0a8:7d]:8090/tutorials/
-
Have Questions? Post them here!
More Posts related to cURL,
- cURL Example using IP (IPv4 and IPv6) address and Port
- Efficient way to perform HTTP cURL GET/POST Requests with Payload
- Save cURL Command Output to a external file
- How to set Connection and Max Timeout for cURL Request with Examples
- [fix] command not found curl
- Fetch only content-type using cURL Command
- Trace using cURL Command Example
- Hide cURL Outputs and Errors on Terminal
- cURL Option to show HTTP Response Status Code
- Downloading Google Chrome using cURL Command
- Perform Basic Authentication using cURL with Examples
- List of 28 Protocols supported by cURL with Examples
- URL Encode cURL HTTP GET\POST Data with Examples
- Get the Size of HTTP Response using cURL Command (Content Length)
- How to get cURL Command to run in verbose mode?
- Get cURL command from Chrome Inspect Network HTTP URL
More Posts:
- List of Useful Mac Terminal Keyboard Shortcuts - MacOS
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. - Android
- Add or remove users from sudo group - Ubuntu - Ubuntu
- Android Error Generating Final Archive - Debug Certificate Expired - Android
- Android : Error in http connection java.net.SocketException: Permission denied - Android
- ls: .: Operation not permitted - Mac Terminal ZSH Error - MacOS
- Change the default git branch name from master to main - Git
- How to change default browser on Mac Monterey - MacOS