I'm sending a request to an usoft IIS server running colfusion scripts and am 
having trouble getting my useragent to establish a session with the host.
i recieve a timed out or session not established 500 server error from the 
host. does anyone know how to establish this kind of session?

This is the script I have been hacking with - 

#! /usr/bin/perl -w

  use LWP::UserAgent;

  $ua1 = LWP::UserAgent->new(requests_redirectable => ['POST','GET','HEAD']);
    my $hdrs = HTTP::Headers->new();
    my $req = HTTP::Request->new(POST , 
'http://www.dpor.state.va.us/regulantlookup/selection_input.cfm' , $hdrs);
    my $resp = $ua1->request($req);
    my $rresp=$resp->as_string;

open (FHA,">prelicense.txt")or die$!;  
  $rresp=~/(CFID=\d+\&CFTOKEN=\d+)/;
   my $token=$1;
  print  FHA $rresp;
 close (FHA);

my $id=<>; 

 my 
$http='http://www.dpor.state.va.us/regulantlookup/IndRealEstateCEDU.CFM?'.$token.'&lrn='.$id;
  my $req2 = HTTP::Request->new(POST , $http , $hdrs);
  my $response =$ua1->request($req2);
    print $http;
  open (FH,">license.txt") or die$!;
  if ($response->is_success) {
     $html=$response->content;
     print FH $html;
     $html=~/(NAME:)(.*)(LEFT">)(.*)(\s<)/;
     print "Is your name?  $4\n"; 
 close (FH);
} else {
 $html=$response->as_string;  # or whatever
     print FH $html;
close(FH);
print "died\n";
     die $response->status_line;
 }
exit:

Any Ideas?

Reply via email to