TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A curl cheat sheet

124 点作者 fcambus超过 9 年前

6 条评论

coderholic超过 9 年前
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 未加载
trashcan超过 9 年前
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 未加载
wldcordeiro超过 9 年前
While great, I stopped using it for httpie instead, it has a much simpler interface.
评论 #10237311 未加载
评论 #10237014 未加载
baldfat超过 9 年前
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.
javajosh超过 9 年前
May I suggest adding `--proxy URL` which is useful if using Charles&#x2F;Fiddler to toggle between environments.
评论 #10237530 未加载
评论 #10239032 未加载
est超过 9 年前
curl -e &quot;referer&quot;