I am getting http code as 000 or Time out on server for the cURL in shell script

amazon-ec2, curl, shell

Solution

also use `-k` or the `--insecure` parameter with your curl commandline to overcome this issue.

Problem

When i am executing this script on server i am getting response code as 000 but i am getting status code as 200 when i am executing this on local machine. This is happening for the same URL & Script. ``` flag=0 for URL in $@ do STATUS=$(curl -s -o /dev/null -w '%{http_code}' $URL) if ([ $STATUS -gt 400 ] || [ $STATUS -lt 100 ]); then echo $URL "is not working fine, STATUS CODE is "$STATUS flag=1 else echo $URL "is working, STATUS CODE is "$STATUS fi done if [ $flag -eq 1 ]; then exit 1 fi ``` I have seen in some forums that the problem is due to SSL. Please let me know what can be changed in above script.

Original source