#!/usr/local/perl5/bin/perl use IO::Socket; $remote = IO::Socket::INET->new(Proto => "tcp", PeerAddr => "your.webserver.here", PeerPort => "80"); unless ($remote) {die "cannot connect to http daemon $@"} $search=&escape($ARGV[0]); $cmd_str="search=$search&addressbook=%2A"; $cmd_str_length=length($cmd_str); print ($remote "POST /cgi-bin/pegabook?find HTTP/1.0\r\n", "Content-type: application/x-www-form-urlencoded\r\n", "Content-length: $cmd_str_length\r\n\r\n", "$cmd_str"); $remote->flush(); print "Searching..\n"; while (<$remote>){ # print; if (/^Name: (.*)<\/B>
$/){ $name=$1; $comment="";} if (/^E-mail: /){ $email=$1;} if (/^Phone: (.+)<\/B>
$/){ $comment .= "Phone $1 ";} if (/^Fax: (.+)<\/B>
$/){ $comment .= "Fax $1 ";} if (/^Description: (.+)<\/B>
$/){ $description = "$1";} if ((/^
$/) and (defined $email) and (defined $name)){ print "$email\t$name\t$description $comment\n"; } } sub escape { my($toencode) = @_; $toencode=~s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg; return $toencode; }