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/
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- cURL Option to show HTTP Response Status Code
- URL Encode cURL HTTP GET\POST Data with Examples
- Capture cURL Request Output to a File
- Fix: Curl No Match Found Error
- trurl: A new command-line tool for URL parsing and manipulation by cURL Developer
- Send JSON Data as Payload using cURL HTTP POST Request
- cURL: Show Request and Response Headers
- Get cURL command from Chrome Inspect Network HTTP URL
- Save cURL Command Output to a external file
- cURL DELETE Request with Examples
- How to URL Encode Data for a cURL Request Parameters
- cURL Example using IP (IPv4 and IPv6) address and Port
- How to convert a Postman request to cURL Command
- [fix] command not found curl
- How to Pretty Print cURL JSON Output in Terminal
- How to follow redirects in cURL Command Request
- How to pass authorization header using cURL
- cURL -x Use of HTTP Proxy Server Examples
- Downloading Google Chrome using cURL Command
- How to get cURL Command to run in verbose mode?
- List of 28 Protocols supported by cURL with Examples
- Hide cURL Outputs and Errors on Terminal
- cURL -d Option with Examples
- How to show SSL Certificate details using cURL Command
- Perform Basic Authentication using cURL with Examples
- Column Mode Editing in Notepad++ - NotepadPlusPlus
- Find MAC address of your laptop device - HowTos
- Rounded Images in Bootstrap framework - Bootstrap
- Setting and Updating AWS CLI Configuration - AWS
- Get the Complete Sha256 Container ID for Docker Run Command - Docker
- How to Center Align Image in Bootstrap - CSS
- How to fix Jenkins Plugin Stuck in Uninstallation pending Status - Linux
- Java Optional Util Class Examples - Java