Perl
Perl
HTTP Post XML
Demonstrates how to POST XML to a website.Chilkat Perl Downloads
use chilkat();
$success = 0;
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
$http = chilkat::CkHttp->new();
# Make sure to replace the URL with something real...
$url = "https://example.com/example.asp";
$xmlBody = "<test>This is the XML to be sent</test>";
$resp = chilkat::CkHttpResponse->new();
$success = $http->HttpStr("POST",$url,$xmlBody,"utf-8","application/xml",$resp);
if ($success == 0) {
print $http->lastErrorText() . "\r\n";
exit;
}
# Examine the body of the response.
print $resp->bodyStr() . "\r\n";