Solved

How To Post From A Script

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

708 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

20 Experts available now in Live!

Get 1:1 Help Now