0

I am sending the curl syntax like below format to get the authorization code value

D:\>curl -k "https://login.mailchimp.com/oauth2/authorize-post" -H "Host: login.mailchimp.com" -H "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" -H "Accept-Encoding: gzip, deflate" -H "Referer: https://www.httpsnow.org/?code=fa4b17caac5cdef9d6a88250d320a9b5" -H "Content-Type: text/plain; charset=UTF-8" -H "Origin: https://www.httpsnow.org" -H "Connection: keep-alive" -H "Pragma: no-cache" -H "Cache-Control: no-cache" --data "username=mailchims&password=Mailchimp"%"403" 

curl: (6) Could not resolve host: login.mailchimp.com

D:\>curl -k "https://login.mailchimp.com/oauth2/authorize-post" -H "Host: login.mailchimp.com" -H "User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" -H "Accept-Encoding: gzip, deflate" -H "Referer: https://www.httpsnow.org/?code=fa4b17caac5cdef9d6a88250d320a9b5" -H "Content-Type: text/plain; charset=UTF-8" -H "Origin: https://www.httpsnow.org" -H "Connection: keep-alive" -H "Pragma: no-cache" -H "Cache-Control: no-cache" --data "username=mailchims&password=Mailchimp"%"403"

▼ ♥☻   ♥ D:>

How to avoid special characters when getting result set? In above output you can see the love symbol at the bottom. Correct my sysntax if i am doing wrong please

user1485267
  • 1,295
  • 2
  • 10
  • 19

2 Answers2

1
curl --compressed
--compressed
  (HTTP) Request a compressed response using one of the algorithms libcurl
  supports, and save the uncompressed document. If this option is used and the
  server sends an unsupported encoding, curl will report an error.

How to properly handle a gzipped page when using curl?

explainshell.com

Community
  • 1
  • 1
Zombo
  • 1
  • 62
  • 391
  • 407
  • Thanks for your reply. I have tried with your command but i face similar result as special characters when redirecting to file.txt – user1485267 Nov 30 '14 at 07:28
0

It seems that the result is a gzip and hence you see the special characters. You could save it in a file and use the silent settings to disable anything in the screen.

Append the following to the curl command line that you have l:

-o [filename] --silent

Replace [filename] with the name of the file to save the response to.

Khanna111
  • 3,627
  • 1
  • 23
  • 25
  • Thanks for your reply. But after trying with your suggestions and saved as txt file in some location then i got result like "‹ ÿÿ " – user1485267 Nov 30 '14 at 07:22
  • Can you please suggest me how to solve my issue to remove special characters when it is redirected to ouput – user1485267 Nov 30 '14 at 07:24
  • After hitting that above command in the command line i am getting from the browser is "https://www.httpsnow.org/?code=4a7322434415d9377a6b76d47171ccb4" but when i am running using curl it shows special characters in the redirected output as filename.txt (‹ ÿÿ ) – user1485267 Nov 30 '14 at 07:26
  • Surprising, I do not get anything on the screen after appending that to the curl command. – Khanna111 Nov 30 '14 at 07:36
  • Are u trying with my above url – user1485267 Nov 30 '14 at 10:16
  • Yes, I use your curl command line and append the line that I have and that is it. You could also try redirect error and output to /dev/null. That should take care of it. – Khanna111 Nov 30 '14 at 10:37
  • Can you share ur gmailid i can forward the image and the curl command what i am using it – user1485267 Nov 30 '14 at 11:10
  • If i add parameter as silent then i am getting blank page. Why it is happening like this.. Can you please suggest – user1485267 Dec 01 '14 at 16:12
  • What do you want to see on the screen? Please paste the output of curl -V – Khanna111 Dec 01 '14 at 17:55
  • If i use curl -V output is "curl 7.32.0 (i386-pc-win32) libcurl/7.32.0 OpenSSL/1.0.0k zlib/1.2.8 Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp smtp smtps telnet tftp Features: AsynchDNS GSS-Negotiate Largefile NTLM SSL SSPI libz" – user1485267 Dec 02 '14 at 04:54
  • I see that there is a HTTP 302 to this curl request. Append "-v" to the command and you would see that there is a redirect. Also if you append "-L" then curl will follow the redirect and you would get a HTTP 404. Seems as if you need to update curl with the correct url whatever that might be. If this helps, please mark the question as answered. – Khanna111 Dec 02 '14 at 07:11