1

I have a license validation webservice provided at http://localhost/testing/validateLicence

I want to write a shell script in such way that I have to pass license key with webservice call . If webservice returns 200 OK then further steps in shell script are executed otherwise execution will be terminated

Please help me in calling web service and comparing http response code in if/else block according to my requirement

1
  • IMHO your license check needs to verify the identity. Commented Feb 25, 2015 at 13:44

1 Answer 1

2

Check out this question:

https://superuser.com/questions/272265/getting-curl-to-output-http-status-code

You should be able tou se something like this (from the second answer there) in a script for your logic:

curl -s -o /dev/null -I -w "%{http_code}" http://www.example.org/

Remove the -I if your web service doesn't like HEAD requests.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.