I am using www::mechanize to log in to a user account and make a search of the db. This has been a straightforward task in the past, I simply create a GET query using a search form, send it to my script, the query is then appended to a url which retrieves the search results to my script and I carry on from there.
However now when I use this method there is a database error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'EndSQLDate'
C:\WWWROOT\CUSTOMERS\K-O\MY\AGENT\../searchresults.asp, line 683
so I cannot retrieve the results.
The strange thing (to me) is that when I use exactly a query which retrieves results when using a browser to log in and search and append that as a query to my script, I get the error. This seems to indicate that the behavior of the browser generated by WWW::Mechanize is not the same as the browser on my computer, and whatever is the difference is having a negative consequence.
Is there some changes I could try to try to emulate better the browser or does anyone have an idea about how I can prevent this error? (By the way, the fact of getting the error demonstrates that log in was successful!)
sub new
{
my ( $this,$id ) = @_;
my $ua = LWP::UserAgent->new(timeout => 90,agent=> 'User-Agent
+=Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) G
+ecko/20091102 Firefox/3.5.7');
$ua->cookie_jar( HTTP::Cookies->new('file' => 'cookies.txt'
+,'autosave'=>1));
$ua->conn_cache(LWP::ConnCache->new());
#$ua->show_progress(1);
push @{ $ua->requests_redirectable }, 'POST';
my $self = {id=>$id, ua=>$ua};
});
bless $self, __PACKAGE__;
}
sub getsearchresults{
my $self = shift;
$self->login;
my $query = $ENV{'QUERY_STRING'};
my $searchurl = 'https://secure.url.net/agent/loadsearchresults.as
+p?' . $query;
my $res;
$res = $self->{ua}->get($searchurl)->content;
print $res;
exit;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.