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:
so I cannot retrieve the results.Microsoft VBScript runtime error '800a000d' Type mismatch: 'EndSQLDate' C:\WWWROOT\CUSTOMERS\K-O\MY\AGENT\../searchresults.asp, line 683
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; }
In reply to www::mechanize not behaving as browser? by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |