RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

WWW Mechanize - 401 Authorization Required

Here is a small script on how to login to a .htaccess protected page. Suppose that URL we want to login to is:

http(:)//www(.)example(.)com/

and here are credentials required to login:

username: www
password: mechanize

The perl script to fetch the content of this page will look like this:

#!/usr/bin/perl

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

$url = 'http://www.example.com/';
$mech->credentials( 'www' => 'mechanize' );
    $mech->get( $url );
    print $mech->content();

Share this linux post:

Submit WWW Mechanize - 401 Authorization Required in Delicious Submit WWW Mechanize - 401 Authorization Required in Digg Submit WWW Mechanize - 401 Authorization Required in FaceBook Submit WWW Mechanize - 401 Authorization Required in Google Bookmarks Submit WWW Mechanize - 401 Authorization Required in Stumbleupon Submit WWW Mechanize - 401 Authorization Required in Technorati Submit WWW Mechanize - 401 Authorization Required in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download