![]() |
|
|
+ Search |
![]()
|
Jul 4th, 2001 03:17
Acebone, Esben Maaløe,
The question was really how to read a web-page *using* VBScript or
JScript. But you can install perl on your webserver and then do like
this
UPDATE: Here's how to do it with VB-Script:
http://www.faqts.com/knowledge_base/view.phtml/aid/5951/fid/202
------------ ASP PAGE BEGINS -------
<SCRIPT LANGUAGE="PerlScript" RUNAT="SERVER">
sub getHTTP() {
my ($url,$file,$method) = @_;
#if the $file parameter is provided
#the content of the retrieved file
#will be saved into the filename in $file
use LWP::UserAgent;
$method = 'GET' unless $method;
my $ua = new LWP::UserAgent;
my $request = new HTTP::Request($method, $url);
$response = $ua->request($request, $file);
return $response->content();
}
</SCRIPT>
<%
strHTTP = getHTTP("http://www.acebone.f2s.com")
response.write(strHTTP)
%>
------------ ASP Page ends ------------
NB! If the URL cannot be found, you won't get an error, just an empty
string. Perhaps the UserAgent object has an error property you could
check.
For some reason this doesn't work on my PWS98 server, but it does on an
IIS4+ server
I recommend ActivePERL -
http://www.activestate.com/Products/ActivePerl/
(BTW - It's really easy to install, and it's free of charge)
© 1999-2004 Synop Pty Ltd