felek
felek

Reputation: 37

HTTP StatusCode 000 when it should be 200 on server for the cURL in shell script

I'm using CURL to get StatusCode at Windows Putty on Linux.

When I try with:

curl -k -I <url>

it gives 200 which is fine:

HTTP/1.1 200 OK Content-Type: text/plain Date: Thu, 01 Jan 1970 00:00:01 GMT Content-Length: 0 Content-Language: en-US

but when I try code below to get only StatusCode number, it gives 000:

curl -o /dev/null --silent --head --write-out '%{http_code}\n' <url>

response: 000

What is the issue here?

Upvotes: 1

Views: 4472

Answers (2)

tetra bag
tetra bag

Reputation: 1

000 more likely means you faced with untrusted certificate issue. Try to add back -k key and you'll get 200

Upvotes: 0

hammadshahir
hammadshahir

Reputation: 380

cURL 000 means server did not respond. It can be due to Firewall blockage, or you are using on localhost or ca issue.

Upvotes: 2

Related Questions