Solved

How To Post From A Script

Posted on 2004-03-23
1
154 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
create an incrementing variable name AutoHotKey 5 80
excel file 5 67
Need to Modify a Script I found 5 93
Bulk Reorder File Names 4 57
The aim of this article is to help you solve the error "Cannot insert the value NULL into column 'ShortDescription', table 'albert_store.dbo.Nop_Product'; column does not allow nulls. UPDATE fails." problem and allow you to continue updating your No…
Are you using email marketing software? If not, you're missing out on effortless marketing and the reaching of desired conversion rates through email marketing software.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now