Sending leads from a site powered by Perl

To send leads in from a lead form's backend code, you would generate a POST XML and post them to the desired POST URL.

For Example:

#!/usr/bin/perl -w

use strict;
use LWP::UserAgent;
use HTTP::Request;

my $xmlString = '<Leads vid="1234" lid="1234" aid="1234">
<Lead reference="ABC1234">

my $userAgent = LWP::UserAgent->new();

my $request = HTTP::Request->new(POST => '');
$request->content_type("text/xml; charset=utf-8");

my $response = $userAgent->request($request);

if($response->code == 200) {
	print $response->as_string;
else {
	print $response->error_as_HTML;
In the example above, the example POST XML is posted to the POST URL. The response is then received and would then be processed to determined the desired action depending on the sending page's requirements and method sent to.

Copyright ©2012