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.

A curl cheat sheet

124 pointsby fcambusover 9 years ago

6 comments

coderholicover 9 years ago
Not strictly a curl hack, but you can quickly get your IP geolocation details with curl and <a href="http:&#x2F;&#x2F;ipinfo.io" rel="nofollow">http:&#x2F;&#x2F;ipinfo.io</a> (full disclosure, it&#x27;s my service):<p><pre><code> $ curl ipinfo.io { &quot;ip&quot;: &quot;208.54.39.206&quot;, &quot;hostname&quot;: &quot;mce2736d0.tmodns.net&quot;, &quot;city&quot;: &quot;Los Angeles&quot;, &quot;region&quot;: &quot;California&quot;, &quot;country&quot;: &quot;US&quot;, &quot;loc&quot;: &quot;34.0522,-118.2437&quot;, &quot;org&quot;: &quot;AS21928 T-Mobile USA, Inc.&quot;, &quot;postal&quot;: &quot;90013&quot;, &quot;phone&quot;: 213 } </code></pre> Or just your IP<p><pre><code> $ curl ipinfo.io&#x2F;ip 208.54.39.206 </code></pre> Or any other field (eg. city)<p><pre><code> $ curl ipinfo.io&#x2F;city Los Angeles </code></pre> Or lookup another IP<p><pre><code> $ curl ipinfo.io&#x2F;8.8.8.8 { &quot;ip&quot;: &quot;8.8.8.8&quot;, &quot;hostname&quot;: &quot;google-public-dns-a.google.com&quot;, &quot;city&quot;: &quot;Mountain View&quot;, &quot;region&quot;: &quot;California&quot;, &quot;country&quot;: &quot;US&quot;, &quot;loc&quot;: &quot;37.3860,-122.0838&quot;, &quot;org&quot;: &quot;AS15169 Google Inc.&quot;, &quot;postal&quot;: &quot;94040&quot;, &quot;phone&quot;: 650 } </code></pre> Or a specific field for that IP:<p><pre><code> $ curl ipinfo.io&#x2F;8.8.8.8&#x2F;org AS15169 Google Inc.</code></pre>
评论 #10237277 未加载
评论 #10237349 未加载
评论 #10238907 未加载
trashcanover 9 years ago
Slightly offtopic, but I highly recommend using httpie for command line http:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;jkbrzt&#x2F;httpie" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jkbrzt&#x2F;httpie</a><p>No cheatsheeet needed, the syntax is a lot friendler.
评论 #10239104 未加载
评论 #10237566 未加载
wldcordeiroover 9 years ago
While great, I stopped using it for httpie instead, it has a much simpler interface.
评论 #10237311 未加载
评论 #10237014 未加载
baldfatover 9 years ago
Confessions. I know I should use curl but I never do and just use wget and think curl is just a one year newer wget :(<p>curl is better tool than wget but I used wget first and never changed. I do use aria2c more now for downloading but I know curl is a great tool I don&#x27;t use.
javajoshover 9 years ago
May I suggest adding `--proxy URL` which is useful if using Charles&#x2F;Fiddler to toggle between environments.
评论 #10237530 未加载
评论 #10239032 未加载
estover 9 years ago
curl -e &quot;referer&quot;