Current location: Hot Scripts Forums » Programming Languages » Perl » Perl & LWP error 501


Perl & LWP error 501

Reply
  #1 (permalink)  
Old 07-29-03, 04:03 PM
tskweb tskweb is offline
Newbie Coder
 
Join Date: Jul 2003
Location: Plano, TX
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Perl & LWP error 501

I am trying to post some information to a web page by using a command prompt in perl.
I am using Getopts() to grab the parameters and format that into a url with a querystring on it.

I am extremely new to perl(been working with perl for a week) and have been been able to get this to work fine thru http although https has proven to be a different story.



I have Openssl installed correctly the version of perl is 5.0005.xxx

It is on a unix box (solaris) and..
the problem it keeps returning a 501 error and schema https not allowed.
Any clues or ideas
I have used the "use lib" to point to the modules on my home directory according to
perl this is perfectly normal to do this if you are not root and have access to install perl stuff....

here is the code
#!/usr/bin/perl -w
use strict;
use lib './libwww/libwww-perl-5.69/lib';
use lib './URI-1.23';
#use lib './libwww/libwww-perl-5.69/Crypt-SSLeay-0.51';
use Getopt::Long;
use LWP::UserAgent;
use URI::URL;
my $ua = LWP::UserAgent->new();
$ua->env_proxy();
$ua->timeout(10);
my $var1 = '0';
my $var2 = '0';
my $var3 = '0';
my $var4 = '0';
my $var5 = '0';
my $var6 = '0';
my $var7 = '0';
my $var8 = '0';
my $var9 = '0';
my $var10 = '0';
my $var11 = '0';
my $var12 = '0';

GetOptions("lname=s"=>\$var1,
"fname=s"=>\$var2,
"custid=s"=>\$var3,
"empid=s"=>\$var4,
"vip=s"=>\$var5,
"company=s"=>\$var6,
"fac=s"=>\$var7,
"office=s"=>\$var8,
"dept=s"=>\$var9,
"state=s"=>\$var10,
"phone=s"=>\$var11,
"email=s"=>\$var12);

my $url = URI->new (sprintf "https://whatever.url.com/e/servicec/CCPSynchronization.asp
?name=<?xml
version=\"1.0\"?><customer><LastName>%s</LastName><FirstName>%s</Fir
stName><RemedyCustomerID>%s</RemedyCustomerID><EmployeeID>%s</EmployeeID
><VIP>%s</VIP><Company>%s</Company><FacilityLocation>%s</FacilityLocation><Office>%s
</Office><Department>%s</Department><State>%s</State><Phone>%s</Pho
ne><Email>%s</Email></customer>",$var1,$var2,$var3,$var4,$var5,$var6,$va r7,$var8,$var9,$var10,$v
ar11,$var12);
my $req = new HTTP::Request('GET',$url);
my $res = $ua->request($req);
print 'URL: '. $url . ' status was: ' . $res->status_line,"\n";
__________________
Scott
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-04-03, 10:59 PM
rob2132 rob2132 is offline
Newbie Coder
 
Join Date: Sep 2003
Location: USA
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by tskweb
I am trying to post some information to a web page by using a command prompt in perl.
I am using Getopts() to grab the parameters and format that into a url with a querystring on it.

I am extremely new to perl(been working with perl for a week) and have been been able to get this to work fine thru http although https has proven to be a different story.



I have Openssl installed correctly the version of perl is 5.0005.xxx

It is on a unix box (solaris) and..
the problem it keeps returning a 501 error and schema https not allowed.
Any clues or ideas
I have used the "use lib" to point to the modules on my home directory according to
perl this is perfectly normal to do this if you are not root and have access to install perl stuff....

here is the code
#!/usr/bin/perl -w
use strict;
use lib './libwww/libwww-perl-5.69/lib';
use lib './URI-1.23';
#use lib './libwww/libwww-perl-5.69/Crypt-SSLeay-0.51';
use Getopt::Long;
use LWP::UserAgent;
use URI::URL;
my $ua = LWP::UserAgent->new();
$ua->env_proxy();
$ua->timeout(10);
my $var1 = '0';
my $var2 = '0';
my $var3 = '0';
my $var4 = '0';
my $var5 = '0';
my $var6 = '0';
my $var7 = '0';
my $var8 = '0';
my $var9 = '0';
my $var10 = '0';
my $var11 = '0';
my $var12 = '0';

GetOptions("lname=s"=>\$var1,
"fname=s"=>\$var2,
"custid=s"=>\$var3,
"empid=s"=>\$var4,
"vip=s"=>\$var5,
"company=s"=>\$var6,
"fac=s"=>\$var7,
"office=s"=>\$var8,
"dept=s"=>\$var9,
"state=s"=>\$var10,
"phone=s"=>\$var11,
"email=s"=>\$var12);

my $url = URI->new (sprintf "https://whatever.url.com/e/servicec/CCPSynchronization.asp
?name=<?xml
version=\"1.0\"?><customer><LastName>%s</LastName><FirstName>%s</Fir
stName><RemedyCustomerID>%s</RemedyCustomerID><EmployeeID>%s</EmployeeID
><VIP>%s</VIP><Company>%s</Company><FacilityLocation>%s</FacilityLocation><Office>%s
</Office><Department>%s</Department><State>%s</State><Phone>%s</Pho
ne><Email>%s</Email></customer>",$var1,$var2,$var3,$var4,$var5,$var6,$va r7,$var8,$var9,$var10,$v
ar11,$var12);
my $req = new HTTP::Request('GET',$url);
my $res = $ua->request($req);
print 'URL: '. $url . ' status was: ' . $res->status_line,"\n";
This looks like a lot of unneeded overhead/work. Did you try replacing GET with POST and not using a Query_string?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
perl newbie has a problem... fowler23 Perl 4 03-24-10 06:14 PM
Includes in Perl digitalsea Perl 12 08-23-04 02:18 PM
Perl CGI wrapper script available? paulbearer Script Requests 0 09-17-03 04:18 PM
Running Perl scripts under Microsoft IIS retrocom Perl 3 08-23-03 05:38 PM
Flatfile single Forum with Perl Gaz General HotScripts Site Discussion 1 08-07-03 05:37 AM


All times are GMT -5. The time now is 12:12 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.