TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Uses for cURL

339 pointsby KrisJordanover 12 years ago

24 comments

bentruymanover 12 years ago
I would strongly suggest HTTPie for the majority of these tasks: <a href="https://github.com/jkbr/httpie" rel="nofollow">https://github.com/jkbr/httpie</a>
评论 #4763283 未加载
评论 #4763057 未加载
评论 #4763236 未加载
评论 #4763895 未加载
评论 #4766456 未加载
k33l0rover 12 years ago
<i>&#62; If you only care about headers use the -I flag and the response body will be hidden</i><p>That is actually wrong. The -I flag set the request method to HEAD. So in some cases it will return different headers than a normal get request (and some servers don't implement HEAD responses at all).
评论 #4764014 未加载
评论 #4763013 未加载
评论 #4763018 未加载
yreadover 12 years ago
If you're on windows and don't feel like using the commandline you can click around in Fiddler to achieve similar things. The help is much shorter <a href="http://www.fiddler2.com/fiddler/help/composer.asp" rel="nofollow">http://www.fiddler2.com/fiddler/help/composer.asp</a><p>I wasn't able to change the Host header successfully, though. A workaround is needed: <a href="https://groups.google.com/forum/?fromgroups=#!topic/httpfiddler/x8edRBYVhmE" rel="nofollow">https://groups.google.com/forum/?fromgroups=#!topic/httpfidd...</a>
评论 #4763812 未加载
laktekover 12 years ago
Nice. I like the way examples were constructed.<p>BTW, here are some more cURL tips I noted down a while back, which I found to be useful for daily work. - <a href="http://laktek.com/2012/03/12/curl-tips-for-daily-use/" rel="nofollow">http://laktek.com/2012/03/12/curl-tips-for-daily-use/</a>
swangover 12 years ago
The site does not work on the iPhone at all if you want to zoom in to read the text. If you start to touch and scroll the menu that was hidden away on the left decides to rear its ugly head and makes the site completely unreadable.<p>I'm pretty frustrated with sites that don't just have a basic two column layout. Is this a template theme? Otherwise why would you waste so much time on a left column that reflows and messes up the browser experience? Or better yet why not test this on an actual mobile browser?<p>I am not trying to harp on this site or the author specifically because there are certainly other offenders. This site though is quite annoying because once you finally think yougot that stupid menu out of the way, BOOM it pops right back an ruins the site again.<p>This is both a rant and a notice to the author since most people probably got too fed up to tell him about this problem.
评论 #4764155 未加载
cypherpunks01over 12 years ago
This title is a bit misleading. I was assuming that I'd be reading about how to use something that <i>wasn't</i> curl?
评论 #4763305 未加载
bryanlarsenover 12 years ago
I knew 8 of the 9, but the one I didn't (testing virtual hosts) was worth the cost of reading the entire article. Thanks.
评论 #4763464 未加载
评论 #4765633 未加载
eik3_deover 12 years ago
&#62; Test Virtual Hosts, Avoid DNS<p>&#62; With cURL just point the request at your host’s IP address<p>It's not even necessary to manually look up the IP, since options have precedence:<p><pre><code> curl server1.example.com -H Host:\ www.example.net </code></pre> looks up server1.example.com and connects to that IP with the given Host: Header. Just try the "-v" option to see what's going on.
antiheroover 12 years ago
Fantastic, there's also a grand tool called httpie that's a bit nicer than curl <a href="https://github.com/jkbr/httpie" rel="nofollow">https://github.com/jkbr/httpie</a>
no_more_deathover 12 years ago
I generally use wget myself. For basic HTTP debugging needs, I run ":%!wget -Sd <a href="http://www.example.com" rel="nofollow">http://www.example.com</a> inside a new vim buffer. Then I can read the Varnish headers or whatever and figure out what's going on.<p>I ran into an issue where the SSL implementation was a bit dated, though, and didn't recognize how a GoDaddy cert implemented multiple hostnames -- but it turned out to follow the standard. wget was just lacking in its implementation and reporting an error when the cert was fine.
RoryHover 12 years ago
Curl is great to have, but remembering all the options flags is a pain. Nowadays I use:<p>Chrome: "Postman" extension<p>Firefox: "REST Client" addon<p>...both great utilities for creating and saving any HTTP request you need.
评论 #4765638 未加载
tomchristieover 12 years ago
I'm sure there must be other sites documenting this too, but that's a very well written and prioritized bit of documentation - nicely done.<p>Your echo service is pretty nifty too.
评论 #4763341 未加载
randomfoolover 12 years ago
Real HTTP from the command line is 'telnet localhost 80'.
评论 #4763580 未加载
评论 #4763582 未加载
scrrrover 12 years ago
This can be combined well with <a href="http://news.ycombinator.com/item?id=4762444" rel="nofollow">http://news.ycombinator.com/item?id=4762444</a> :)
agiover 12 years ago
Nice!!! Here is one more when it comes to working with the Internet Of Things: <a href="http://cosm.com/docs/quickstart/curl.html" rel="nofollow">http://cosm.com/docs/quickstart/curl.html</a> And using this I was inspired and managed to do this: <a href="http://www.agilart.com/blog/agilart-programs-using-cosm" rel="nofollow">http://www.agilart.com/blog/agilart-programs-using-cosm</a> #YAY
sravfeynover 12 years ago
I never learnt cURL, or for that matter missed many of command-line tools because of the laziness to read boring long man pages. This is a perfect example of how a man page should be. All the options explained one by one with simple examples! It took me hardly 5 minutes, now I feel confident in using cURL for my next use.
goronbjornover 12 years ago
This is a great resource. We use curl for sample API calls in our docs (developers.box.com/docs) because it's ubiquitous, but we've come to learn over time that knowledge of how to use curl is not ubiquitous.<p>Thanks for making this!
alpbover 12 years ago
I can add -I parameter to these. It sends a HEAD request, which only returns headers, works better when you don't need the response body as in -i.
nodesocketover 12 years ago
`curl --head <a href="http://google.com`" rel="nofollow">http://google.com`</a> is useful just to get the response headers back.
stephenhueyover 12 years ago
And if you prefer Ruby, try out htty: <a href="https://github.com/htty/htty" rel="nofollow">https://github.com/htty/htty</a>
评论 #4763608 未加载
boggzPitover 12 years ago
Does someone knows how to use Google Analytics API with cURL?<p>btw: nice overview!
hokaover 12 years ago
Helpful. I 'know' these, but this is a good cheat sheet to save around.<p>Really like the casual plug of your new project; I signed up :-)
drivebyacct2over 12 years ago
Why do people like cURL? I've regularly found it to have stupid defaults compared to wget. Is it because it's default on Mac and wget isn't?
评论 #4763845 未加载
评论 #4763747 未加载
caludioover 12 years ago
I hope tomorrow I'll see an even more useful article on sending email from the command line! Wow. /sarcasm
评论 #4768289 未加载
评论 #4763352 未加载