LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2016, 09:45 AM   #1
LYC
Member
 
Registered: Jan 2014
Posts: 100

Rep: Reputation: Disabled
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.
 
Old 06-15-2016, 10:24 AM   #2
Turbocapitalist
Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 963
Blog Entries: 3

Rep: Reputation: 393Reputation: 393Reputation: 393Reputation: 393
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/...
 
1 members found this post helpful.
Old 06-15-2016, 09:48 PM   #3
LYC
Member
 
Registered: Jan 2014
Posts: 100

Original Poster
Rep: Reputation: Disabled
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?

Last edited by LYC; 06-15-2016 at 09:56 PM.
 
Old 06-15-2016, 11:04 PM   #4
Turbocapitalist
Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 963
Blog Entries: 3

Rep: Reputation: 393Reputation: 393Reputation: 393Reputation: 393
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
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CentOS 6.7 has really OLD curl. Best way to update curl? sneakyimp Linux - Server 4 04-26-2016 04:06 PM
Queries on Curl command dhanesh.koliyat Linux - Newbie 1 10-11-2011 10:35 AM
queries cadb4u Linux - Newbie 1 08-18-2011 08:07 AM
cURL: Server has many IPs, how would I make a cURL script use those IPs to send data? guest Programming 0 04-11-2009 12:42 PM
***Queries for all of u***** LinuxRam Linux - General 6 08-02-2004 02:09 PM


All times are GMT -5. The time now is 04:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration