View Single Post
  #2 (permalink)  
Old 10-04-03, 09: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?
Reply With Quote