Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking if site is available using shell and curl for https URL redirect

Tags:

shell

curl

https

I wanted to check if the https://fusionhelp.oracle.com website is available or not. After going through the posts in this site, tried using the curl script as shown below on the linux command prompt :

curl https://fusionhelp.oracle.com -L -o dumpfile -w 'Last URL was: %{url_effective}'

curl -vi -I -L --cacert FusionhelpRepository https-fusionhelp-website

FusionhelpRepository contains the security certificates.pem merged into one file.

I get curl: (7) socket error: 113 , instead of a status code which would suggest that the website is available. I expect the first response to be 302, after which it should get redirected to the destination page.

I'm aware that many such posts have been made earlier and the solution works for Yahoo or Google or other HTTPS website which I have been accessing. This one is not going through.

like image 313
user3274631 Avatar asked Feb 05 '14 10:02

user3274631


People also ask

How do I check if a curl URL is valid?

Try running wget google.com/asdf and curl google.com/asdf . curl returns EXIT_SUCCESS by default when encountering a 404 error, while wget returns EXIT_FAILURE. That's what the --spider argument is for: it makes wget return after checking for the file's existence instead of downloading it.

How do I test my website using curl command?

The syntax for the curl command is as follows: curl [options] [URL...] In its simplest form, when invoked without any option, curl displays the specified resource to the standard output. The command will print the source code of the example.com homepage in your terminal window.

How do I check curl connectivity?

To use curl to test basic network connectivity, you need to know several things: The remote server name or IP address. The protocol for the service to be tested (HTTP, FTP, SMTP, etc.) The port number for the network application you want to test.

How do I know if a website is reachable in Linux?

Check a website availability with CURL Status code '200 OK' means that the request has succeeded and a website is reachable.


1 Answers

I think you just need the -I option here:

curl -I https://fusionhelp.oracle.com

This will give the response code, currently showing 503 Service Unavailable.

like image 77
pokero Avatar answered Sep 30 '22 08:09

pokero