LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   curl queries (https://www.linuxquestions.org/questions/linux-newbie-8/curl-queries-4175582326/)

LYC 06-15-2016 08:45 AM

curl queries
 
Hi,

When accessing an URL using PC browser such as IE and Chrome has no problem but when using "curl -Is https://<URL>" to access, the return is "HTTP error 405", what have I been missed out?

Thanks in advance.

Turbocapitalist 06-15-2016 09:24 AM

Maybe something server side is causing the 405

What about with "wget"?

Code:

wget -S -q -O /dev/null https://server.example.com/...
Or with another User-Agent string in the request header?

Code:

curl -Is -A "Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0" https://server.example.com/...

LYC 06-15-2016 08:48 PM

Hi,

The wget works but not sure why when I used "wget -S -q -O /dev/null https://server.example.com/... | grep 200" (This is to verify that the URL is working with the return of "HTTP/1.1 200 OK" by grep) it does not work as expected though the return of the command display on screen consists of "HTTP/1.1 200 OK"? If I output the result to a file (-O /tmp/file), the content of the file is not the same as display on screen?

Turbocapitalist 06-15-2016 10:04 PM

The headers are sent to stderr instead, so you have to redirect them to stdout if you want to filter them with "grep"

Code:

wget -S -q -O /dev/null https://server.example.com/  2>&1 | grep 200


All times are GMT -5. The time now is 09:08 AM.