Skip to content

Instantly share code, notes, and snippets.

@tbrowder
Created August 16, 2017 17:07
Show Gist options
  • Save tbrowder/1edc730800580626b359fe560c495353 to your computer and use it in GitHub Desktop.
Save tbrowder/1edc730800580626b359fe560c495353 to your computer and use it in GitHub Desktop.
LibCurl use
# assemble a constant API call portion
my $Call = "{$service-url}/xml.response?";
$Call ~= "ApiUser={$ncuser}&ApiKey={$service-key}";
$Call ~= "&UserName={$ncuser}&ClientIP={$client-ip}";
$Call ~= "&Command=namecheap."; # <= note the trailing dot
# get the list of doms
get-hosts-list;
sub get-hosts-list() {
my $call = $Call ~ "domains.getList&PageSize=100";
if $debug {
say $call;
exit;
}
my $http = LibCurl::HTTP.new;
my $xml = $http.GET($call).perform.content;
say $xml;
# $http.GET('http://example.com').perform.content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment