Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > help with Perl Mechanize

Thread Tools

help with Perl Mechanize

Posts: n/a
Would anyone help me with this little script that I tried to get some
contents from Yahoo Personals by using Perl Mechanize. It doesn't
return any results, although I've feed all kinds of browser headers.
Do I miss anything? Any comment is highly appreciated!!


#!/usr/bin/perl -w

use WWW::Mechanize;
use strict;

my $mech=WWW::Mechanize->new();

$mech->add_header(HTTP_ACCEPT => 'image/gif, '*/*');
$mech->add_header(HTTP_ACCEPT_ENCODING => 'gzip, deflate');
$mech->add_header(HTTP_ACCEPT_LANGUAGE => 'en-us');
$mech->add_header(HTTP_CONNECTION => 'Keep-Alive');
$mech->add_header(HTTP_USER_AGENT => 'Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.0; yie6; Q312461; .NET CLR 1.0.3705; .NET CLR
$mech->add_header(REQUEST_METHOD => 'GET');
$mech->add_header(Referer => '');
$mech->success or die $mech->response->status_line;

$mech->field('r_gender_pref' => "1");
$mech->field('r_gender' => "2");
$mech->field('r_min_age' => "25");
$mech->field('r_max_age' => "35");
$mech->field('csz' => "94011");

$mech->success or die "post failed:",$mech->response->status_line;

print $mech->content();
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with mechanize Neal Becker Python 0 08-06-2008 11:16 AM
Need Help in Aol Login with mechanize Md.elme focruzzaman Shuvo Ruby 0 06-17-2007 01:16 PM
Mechanize: Can't get it to work. Can I help make it work next week? Xeno Campanoli Ruby 1 07-01-2005 10:32 PM
help with Perl Mechanize bernice tsai Perl Misc 0 02-27-2004 08:38 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM