'IPV6 Curl POST request

In IPV6 how to build CURL POST http request with the IPV6 address and port number.Any kind of thread will be appreciated.

Tried to build the request as below

>curl --interface 'http://[2001:0:db8:1111:0:0:0:11]:8091/?'

But above gave error as "curl: NO URL specified"

>curl -X POST -d  curl -X POST `http://[2001:0:db8:1111:0:0:0:11]:8091/?`

Then tried the above that gave error as

>bash: http://[2001:0:db8:1111:0:0:0:11]:8091/?: No such file or directory
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

Is there any alternate method, other than using URL



Solution 1:[1]

curl -g -d post 'http://[2001:0:db8:1111:0:0:0:11]:8091/'

The -g option was necessary "back in the old days" when you used IPv6 addresses. It stops curl from treating the [] symbols in the URL as globbing instructions. (since curl 7.37.0 (May 2014), curl no longer mistakes numerical IPv6 addresses for globbing, making the use of -g in this case no longer necessary)

The -d is of course for posting. You can slap on a -v too to get to see details from the operation.

(And no, -X POST should not be in the command line at all when -d is used.)

Solution 2:[2]

curl -4 for an IPv4 request and curl -6 for an IPv6 request are the arguments, that you can use.

For your examle, this should work:

curl -6 -d post 'http://2001:0:db8:1111:0:0:0:11:8091/'

Solution 3:[3]

windows commandline:

curl -X POST http://[fe80::a989:2147:5f46:a4f3%4]:58080/i2/xxx.php? -H "Content-Type:application/x-www-form-urlencoded" -d "language=xx&action=login_in&username=xxx&pd=xxxx&choose=0&remember=0&yanzheng=4778" enter image description here


-X, --request: HTTP method for communicating with the server.

-H, --header: HTTP headers to send to the server with POST request.

-d, --data: Data to be sent to the server using a POST request in the form of key/value pairs.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 mkirbst
Solution 3