Solved

How To Post From A Script

Posted on 2004-03-23
1
157 Views
Last Modified: 2013-12-25
I need to post some XML to an external web address (Java servlet on another web server) from within a shopping cart written in perl. I need example code for how to do this. I also need to know if it can be done to an SSL address.
0
Comment
Question by:jimkat
1 Comment
 
LVL 4

Accepted Solution

by:
AsbjornG earned 500 total points
ID: 10665794
Hi Jimkat,

Try like this:

use LWP::UserAgent;
$ua = new LWP::UserAgent;
$req = new HTTP::Request 'POST','https://www.webserver.com/script.pl';
$req->content_type('application/x-www-form-urlencoded');
$req->content("variable1=value1&variable2=value2&variable3=value3");
$res = $ua->request($req);

the $res variable will contain the result of your post.

You will of course need to have the LWP module installed, and  Crypt::SSLeay or
IO::Socket::SSL will be necessary to communicate through SSL.


Hope this helps.

Asbjorn
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question