如何使用unix和perl打开网站,在框中输入文本,按;“去”;,然后保存结果?

如何使用unix和perl打开网站,在框中输入文本,按;“去”;,然后保存结果?,perl,unix,web-scraping,Perl,Unix,Web Scraping,很抱歉问了这么大的问题,但我只是不知道如何更好地描述这一点,甚至不知道该行动的名称。它类似于网络刮板,但也与网站交互 我不想做任何邪恶的事情,我只是需要在一个公共网站上做200个查询,我真的不想一个接一个地输入它们。基本上,我只想使用unix工具(可能是lynx?类似的东西?)或一些perl脚本访问网站,在“搜索”字段中输入文本,按“go”,然后保存整个页面的结果 谢谢 perl -MWWW::Mechanize::Shell -e shell 然后:获取、填写、打开、提交。完成web交互后,

很抱歉问了这么大的问题,但我只是不知道如何更好地描述这一点,甚至不知道该行动的名称。它类似于网络刮板,但也与网站交互

我不想做任何邪恶的事情,我只是需要在一个公共网站上做200个查询,我真的不想一个接一个地输入它们。基本上,我只想使用unix工具(可能是lynx?类似的东西?)或一些perl脚本访问网站,在“搜索”字段中输入文本,按“go”,然后保存整个页面的结果

谢谢

perl -MWWW::Mechanize::Shell -e shell
然后:获取、填写、打开、提交。完成web交互后,执行:
script
并将输出保存到
whatever.pl

示例会话:

$ perl -MWWW::Mechanize::Shell -e shell

(no url)>get http://google.com/

http://www.google.pl/>fillout
(text)q> [] depesz

http://www.google.pl/>submit
200

http://www.google.pl/search?ie=ISO-8859-2&hl=pl&source=hp&q=depesz&gbv=1>script
#!/opt/perlbrew/perls/perl-5.18.0/bin/perl -w
use strict;
use WWW::Mechanize;
use WWW::Mechanize::FormFiller;
use URI::URL;

my $agent = WWW::Mechanize->new( autocheck => 1 );
my $formfiller = WWW::Mechanize::FormFiller->new();
$agent->env_proxy();

  $agent->get('http://google.com/');
   $agent->form_number(1) if $agent->forms and scalar @{$agent->forms};
  $formfiller->add_filler( 'q' => Fixed => 'depesz' );$formfiller->fill_form($agent->current_form);
  $agent->submit();
然后:获取、填写、打开、提交。完成web交互后,执行:
script
并将输出保存到
whatever.pl

示例会话:

$ perl -MWWW::Mechanize::Shell -e shell

(no url)>get http://google.com/

http://www.google.pl/>fillout
(text)q> [] depesz

http://www.google.pl/>submit
200

http://www.google.pl/search?ie=ISO-8859-2&hl=pl&source=hp&q=depesz&gbv=1>script
#!/opt/perlbrew/perls/perl-5.18.0/bin/perl -w
use strict;
use WWW::Mechanize;
use WWW::Mechanize::FormFiller;
use URI::URL;

my $agent = WWW::Mechanize->new( autocheck => 1 );
my $formfiller = WWW::Mechanize::FormFiller->new();
$agent->env_proxy();

  $agent->get('http://google.com/');
   $agent->form_number(1) if $agent->forms and scalar @{$agent->forms};
  $formfiller->add_filler( 'q' => Fixed => 'depesz' );$formfiller->fill_form($agent->current_form);
  $agent->submit();

看一看,看一看,谢谢,我要试一试!谢谢,我试试看!