I get http code as 000 or Time out on server for cURL in shell script

When I execute this script on the server, I get the response code as 000, but I get the status code 200 when I execute it on the local machine. This happens for one URL and 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 on some forums that the problem is with SSL. Please let me know what can be changed in Script.

+4
source share
1 answer

also use the option -kor --insecureusing your command line to fix this problem.

+6
source

Source: https://habr.com/ru/post/1524126/


All Articles