Chinaunix

标题: linux shell中如何实现http调用? [打印本页]

作者: shangdi    时间: 2005-09-02 16:48
标题: linux shell中如何实现http调用?
有一个需求是这样的:有一个url: http://10.1.1.1/aa.jsp 在ie中执行的时候返回0。现在我想写一个shell脚本,在脚本中调用这个url,然后我取返回值!不知道如何实现,各位大侠帮忙了。多谢!
作者: archangle    时间: 2005-09-02 16:57
标题: linux shell中如何实现http调用?
用curl或者wget不知道行不行。或者用lynx,w3c,w3m,一个一个的测试吧。
作者: q1208c    时间: 2005-09-02 17:37
标题: linux shell中如何实现http调用?
用 perl .
作者: hongfengyue    时间: 2005-09-02 22:11
标题: linux shell中如何实现http调用?
用curl肯定可以得。我做个得。没有问题。
或者使用curllib库自己写一个c程序编译出来用。很好用得,而且curl上有很多的curllib库使用得例子。非常好懂。
作者: shangdi    时间: 2005-09-05 10:03
标题: linux shell中如何实现http调用?
能给个示例吗?在linux里测试了好长时间没实现。多谢!
作者: starferry    时间: 2005-09-05 13:35
标题: linux shell中如何实现http调用?
use strict;
use warnings;
use LWP::UserAgent;

my $url = "http://$ARGV[1]ARGV[2]/index.jsp";
my $agent = new LWP::UserAgent();
$agent->;agent('Mozilla/4.0');
$agent->;timeout($ARGV[0]);

my $request = new HTTP::Request('GET' =>; $url);
my $response = $agent->;request($request);
.................
.................




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2