简体   繁体   中英

curl POST and GET response

I'm trying to write a simple one-liner that will take a .crt and pass it to the CRT checker as SSLShopper.com. I can POST the data, but all I get back is headers and the HTTP response. The form on their site seems simple enough, just an AJAX call that returns the result. This is what I have so far:

curl -L -i -X POST -k "https://www.sslshopper.com/assets/snippets/sslshopper/ajax/ajax_decode.php" --data-binary @test.crt

Is there any way to POST and GET at the same time?

It seems you need to send the data in form-url-encoded format with following parameters :

  • cert_text={CERT_CONTENT}
  • decode_type=certificate

You need also X-Requested-With: XMLHttpRequest & Connection: keep-alive headers :

cert_content=$(cat test.crt)
curl 'https://www.sslshopper.com/assets/snippets/sslshopper/ajax/ajax_decode.php' \
    -H 'X-Requested-With: XMLHttpRequest' \
    -H 'Connection: keep-alive' \
    --data-urlencode "cert_text=$cert_content" \
    --data-urlencode "decode_type=certificate"

But for this task, you don't need to call some endpoint to check a certificate, as it's specified in https://www.sslshopper.com/certificate-decoder.html , you can use directly :

openssl x509 -in test.crt -noout -subject -enddate -startdate -issuer -serial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM