Basically, I try to log in and get a search page. This is a JSP/java/javascript on apache server so I can actually get to the main page, but anything else returns an error page that the URL processor could not comply with the request the funny thing is that it returns the encrypted version of the URL/URI not the original. original: WTPart:10240573&u8 encrypted: WTPart%3A10240573&
I was hoping that somene knew what is going on and if I can fix this. Here is the code. I'll send more detailed stuff if you reply and are interested in helping out. thanks Fonss #! /usr/bin/perl -w ############################################################################## # this is a test piece that logs into PDMlink # This is a product of Fonss ############################################################################## use strict; use HTML::Form; #use utf8; use LWP; use LWP::Simple; use LWP::UserAgent; use LWP::Debug qw(+); use HTTP::Cookies::Netscape; use URI; ############################## #our $url = ' http://primos.isecorp.com/pdmlink/wtcore/jsp/report/bom/dispatcher.jsp'; #our $url = ' http://primos.isecorp.com/pdmlink/wtcore/jsp/report/bom/dispatcher.jsp?oid=wt.part.WTPart:10240573&u8=1&action=PLMBOMHierarchy&cookieName=PartStructure-wt.part.WTPart:10240573 '; # http://primos.isecorp.com/pdmlink/wtcore/jsp/report/bom/dispatcher.jsp?oid=wt.part.WTPart%3A10240573&u8=1&action=PLMBOMHierarchy&cookieName=PartStructure-wt.part.WTPart%3A10240573 our $browser; our $cookie_jar; ############################### $browser = LWP::UserAgent->new; $browser->credentials( 'deimos.isecorp.com:80', # or http://priimos.isecorp.com Don't forget the ":80"! 'Windchill', 'username' => 'password' #too open, need a view only account ); ############################ my %agents = ( 0 => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', 1 => 'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)', 2 => 'Mozilla/5.0 Galeon/1.2.5 (X11; Linux i686; U;) Gecko/20020606', 3 => 'Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.04 [en]', 4 => 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)', 5 => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv: 1.7b) Gecko/20040421', 6 => 'Mozilla 4.0 (compatible; MSIE 5.01; Windows NT 5.0)', 7 => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)', 8 => 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0; LVR)', 9 => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)', 10 => 'Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.1b) Gecko/20020722' ); my $max = -1; $max++ foreach (keys %agents); $browser->agent ($agents{int (rand ($max))}); ######################### my $cookies = new HTTP::Cookies; $browser->cookie_jar ($cookies); #my $response = $browser->get($baseurl); my $url = URI->new(' http://priimos.isecorp.com/pdmlink/wtcore/jsp/report/bom/dispatcher.jsp'); #my $url = URI->new( ' http://priimos.isecorp.com/pdmlink/wtcore/jsp/report/bom/dispatcher.jsp?oid=wt.part.WTPart:10240573&u8=1&action=PLMBOMHierarchy&cookieName=PartStructure-wt.part.WTPart:10240573' ); print "Getting from $url\n"; # makes an object representing the URL $url->query_form( # And here the form data pairs: 'oid' => 'wt.part.WTPart:10240573', 'u8' => '1', 'action' => 'PLMBOMHierarchy', 'cookieName' => 'PartStructure-wt.part.WTPart:10240573', ); my $response = $browser->get($url); die "Error getting $url: ", $response->status_line #die "Error getting $url: ", $response->content_ref if $response->is_error; die "Hmm, error \"", $response->status_line( ), "\" when getting $url" unless $response->is_success( ); my $content_type = $response->content_type( ); die "Hm, unexpected content type $content_type from $url" unless $content_type eq 'text/html'; my $content = $response->content( ); die "Odd, the content from $url is awfully short!" if length($content) < 30; print $content;
_______________________________________________ Perl-Win32-Web mailing list Perl-Win32-Web@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs