关于curl ifconfig.me返回ip的疑问

435 views
Skip to first unread message

Lan Zhang

unread,
Sep 16, 2011, 3:45:57 AM9/16/11
to shlug
不知道算不算OT

我想问:
curl ifconfig.me
怎么会返回ip地址的?按理curl不是应该返回网页内容吗?
谁知道这个,能帮我解释一下原理吗?


谢谢

Xi Shen

unread,
Sep 16, 2011, 3:53:56 AM9/16/11
to sh...@googlegroups.com
人家的页面上就告诉你了,用curl就是只返回ip地址。它应该是用curl发送的user-agent头来判定应该怎么返回结果的。


2011/9/16 Lan Zhang <zet...@gmail.com>:

--
Regards,
David Shen

http://about.me/davidshen
https://twitter.com/#!/davidshen84

Marco

unread,
Sep 16, 2011, 4:00:33 AM9/16/11
to sh...@googlegroups.com
ifconfig.me 的服务器判断了一下User-Agent,

你可以修改firefox的配置, 改成curl, 也会直接返回ip的


2011/9/16 Lan Zhang <zet...@gmail.com>



--
LinuX
Violin
Canon EOS

Lan Zhang

unread,
Sep 16, 2011, 4:13:04 AM9/16/11
to sh...@googlegroups.com
嗯,确实如此。多谢!

2011/9/16 Marco <chopi...@gmail.com>:

小马xiaoma

unread,
Sep 16, 2011, 5:46:09 AM9/16/11
to sh...@googlegroups.com
+1

Qf Yang

unread,
Sep 16, 2011, 6:18:13 AM9/16/11
to sh...@googlegroups.com
ifconfig.me 的开发者太有才了!

Lan Zhang

unread,
Sep 16, 2011, 7:16:28 AM9/16/11
to sh...@googlegroups.com
刚学php,下午在sae上模仿了一个
http://ifconfig.sinaapp.com/


2011/9/16 Qf Yang <fen...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages