Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Authentication Workaround?

Status
Not open for further replies.

denise1

IS-IT--Management
Jan 30, 2003
1
CA
Hi,

I've written a basic script below which normally works to grab pages but not from my protected site. Naturally I know the Realm, Username and Password but don't know how to incorporate it into my current program to get access to the pages.

Hope someone out there can help!

Denise :)
-----------------------------------------------------

#!/usr/bin/perl

&IOSocket;

sub IOSocket{
use IO::Socket;
$method = "GET";
my @f = split(/\//, $input);
$host = " #their domain...
$path = "/their/root/protected"; #protected root etc...
$socket = new IO::Socket::INET( PeerAddr => $host,
PeerPort => 80,
Proto => 'tcp',
Type => SOCK_STREAM, ) or die &printout;
print $socket "$method $path HTTP/1.0\nReferer: $host\n";
print $socket "User-Agent: $ENV{'HTTP_USER_AGENT'}\n\n";
@output = <$socket>;
close ($socket);
}


$FILE=&quot;d:/Inetpub/mydomain/file.htm&quot;; #my local domain directory path

open(WRBK,&quot;>$FILE&quot;);

print WRBK &quot;@output\n&quot;;

close(WRBK);

exit;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top