curl resolver:
curl --resolve example.com:80:127.0.0.1 http://example.com/
Tag Archives: curl
parse error: Invalid numeric literal at line 1,
curl remove -i:
curl -X POST -H 'Content-type:application/json' -d @my_file https://192.168.100.100/api.php | jq .
curl check ssl certificate expiration
curl --insecure -vvI https://www.srv24x7.com 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'
curl 301 moved permanently
curl -iL --max-redirs 1 http://example.com
curl and POST, GET, PUT, DELETE
Make requests with data:
Since we learn how to make POST, GET, PUT, DELETE requests, we can now make same requests with data. In order to send data with those requests, we should use –data parameter. Here are some examples:
::::/bin/bash
# send login data with POST request
curl –request POST ‘http://www.linuxhow.tk/login/’ \
–data ‘username=myusername&password=mypassword’
# send search data to with get request
curl –request GET ‘http://www.linuxhow.tk/results?search_query=my_keyword’
# send PUT request with data
curl –request PUT ‘http://www.linuxhow.tk/rest-api/user/12345/’\
–data ’[email protected]’
# same thing but this one get data from a file named data.txt
curl –request PUT ‘http://www.linuxhow.tk/user/12345/’\
–data @data.txt