[thelist] [ASP] HTTP Requests using PerlScript

pouncyisdead pouncy_1 at hotmail.com
Wed Feb 26 17:51:01 CST 2003


I am trying to pull a remote page's content into an ASP page, as a string
variable, using perl subroutines.
It works rather inconsistently (IE: 75% of the time it works fine, 5% it
pulls nothing, 20% it wont initialize at all).
I would like this script to run consistently even if it slows the ASP page's
performance  down.
I am running this script on a remotely hosted IIS 5.1 with ASPN activestate
perl, so access to the OS is rather hard.

Usage:

<%@ Language="VBScript" ENABLESESSIONSTATE=false %>
<% Option Explicit %>

<script language="perlscript" runat="server">
sub drawURL{
 use strict;  use LWP::UserAgent;  use HTTP::Request::Common qw(GET);

 my $url = shift;

 my $ua = new LWP::UserAgent;
   $ua->agent("Mozilla/4.0 (compatible; MSIE 4.0; Windows NT)");

 my $req = GET $url;
   $req->header('Accept' => 'text/*');

 my $page = $ua->request($req)->as_string;
 return $page;

close $url; close $ua; close $req; close $page; exit();

}
</script>

<% DIM urlXM,strPage

'// -  urlXM is a database defined var
urlXM = "http://someserver.co/somepage.html"

strPage = drawURL(urlXM)
Response.Write(strPage)

%>

Any Advice?

Mike Pouncy || http://www.AvantArts.com/



More information about the thelist mailing list