[Wylug-help] http logging

Stephen Patterson steve at patter.mine.nu
Tue Feb 26 15:01:23 GMT 2008


On 26 Feb 08, Gary Stainburn (gary.stainburn at ringways.co.uk) wrote:
> Hi folks.
> 
> I'm wanting to automate extracting data from a web site that requires a login 
> dialog to be completed before the data is available.
> 
> I've tried playing with wget to try to simulate the conversation manually 
> before looking at a perl or PHP script to automate the process.

You could do it with perl & WWW::Mechanize, that can handle form
filling, cookies & masquerade as IE.
http://search.cpan.org/~petdance/WWW-Mechanize-1.34/lib/WWW/Mechanize.pm

my $mech = WWW::Mechanize->new(
    cookie_jar => {},
    autocheck  => 1,
    agent_alias => 'Windows IE 6');

$mech->get('http://form address');
$mech->submit_form(
    form_name => 'login',
    fields => { user => $username,
                pass => $password });

# print login response
print $mech->content();

-- 
Stephen Patterson :: steve at patter.mine.nu :: http://patter.mine.nu/
GPG: B416F0DE :: Jabber: patter at jabber.earth.li 
"Don't be silly, Minnie. Who'd be walking round these cliffs with a gas oven?"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://list.wylug.org.uk/pipermail/wylug-help/attachments/20080226/8465bb48/attachment.bin


More information about the Wylug-help mailing list