view release on metacpan or search on metacpan
lib/Business/OnlinePayment/BitPay/Client.pm view on Meta::CPAN
use Carp;
use warnings;
use Mozilla::CA;
use LWP::UserAgent;
use HTTP::Request;
use LWP::Protocol::https;
use Business::OnlinePayment::BitPay::KeyUtils;
use JSON;
use JSON::Parse 'parse_json';
require IO::Socket::SSL;
lib/Business/OnlinePayment/BitPay/Client.pm view on Meta::CPAN
my %opts = @_;
my $path = $opts{"path"};
my $public = $opts{"public"};
my $uri = $self->{apiUri} or croak "no api_uri exists for object";
$uri = $uri . "/" . $path;
my $request = HTTP::Request->new(GET => $uri);
$request->content($jsonc);
$request->header('content-type' => 'application/json');
$request->header('X-BitPay-Plugin-Info' => 'PerlLib');
$request->header('User-Agent' => 'perl-bitpay-client');
unless($public){
lib/Business/OnlinePayment/BitPay/Client.pm view on Meta::CPAN
my %opts = @_;
my $path = $opts{"path"};
my %content = %{%opts->{"params"}};
my $uri = $self->{apiUri} or croak "no api_uri exists for object";
$uri = $uri . "/" . $path;
my $request = HTTP::Request->new(POST => $uri);
my $ua = LWP::UserAgent->new;
$ua->ssl_opts( verify_hostname=> 0, SSL_ca_file => Mozilla::CA::SSL_ca_file(), SSL_Version => 'TLSv2', SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE);
my $jsonc = encode_json \%content;
$request->content($jsonc);
$request->header('content-type' => 'application/json');
view all matches for this distribution
view release on metacpan or search on metacpan
use strict;
use warnings;
use Mozilla::CA;
use Test::More;
use LWP::UserAgent;
use HTTP::Request;
use LWP::Protocol::https;
use JSON;
use JSON::Parse 'parse_json';
use IO::Socket::SSL;
sub test_can_connect_to_bitpay_api {
my $uri = "https://bitpay.com/tokens";
my $pem = Business::OnlinePayment::BitPay::KeyUtils::bpGeneratePem();
my $sin = Business::OnlinePayment::BitPay::KeyUtils::bpGenerateSinFromPem($pem);
my $request = HTTP::Request->new(POST => $uri);
$request->header('content-type' => 'application/json');
my %content = ('id'=>$sin);
my $jsonc = encode_json \%content;
$request->content($jsonc);
my $ua = LWP::UserAgent->new;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/OnlinePayment/Iridium/Action.pm view on Meta::CPAN
package Business::OnlinePayment::Iridium::Action;
use Moose::Role;
use Template;
use LWP::UserAgent ();
use HTTP::Request ();
use XML::Simple ();
# PODNAME: Business::OnlinePayment::Iridium::Action
# ABSTRACT: Send / receive data to / from PayVector
lib/Business/OnlinePayment/Iridium/Action.pm view on Meta::CPAN
my $content = $self->_build_req_content;
my $action_url = 'https://www.thepaymentgateway.net/';
my $ua = $self->_user_agent;
my @SERVERS = $self->SERVERS;
my $req = HTTP::Request->new( POST => $SERVERS[0] );
$req->content_type('text/xml; charset=UTF-8');
$req->header( 'SOAPAction' => $action_url . $self->_type );
$req->content($content);
$req->content_length( length($content) );
my $res = $ua->request($req);
view all matches for this distribution
view release on metacpan or search on metacpan
use Carp;
use Tie::IxHash;
use XML::Simple;
use XML::Writer;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common qw (POST);
use Date::Calc qw(Add_Delta_YM Add_Delta_Days);
use Business::OnlinePayment;
#use Business::OnlinePayment::HTTPS;
use vars qw($VERSION $DEBUG @ISA $me);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/PayPal/NVP.pm view on Meta::CPAN
my %args = @_;
my $lwp = $UserAgent;
$lwp->timeout($Timeout) if $Timeout;
$lwp->agent("perl-Business-PayPal-NVP/$VERSION");
my $req = HTTP::Request->new( POST => $self->AUTH_CRED('url') );
$req->content_type( 'application/x-www-form-urlencoded' );
my $content = _build_content( USER => $self->AUTH_CRED('user'),
PWD => $self->AUTH_CRED('pwd'),
SIGNATURE => $self->AUTH_CRED('sig'),
view all matches for this distribution
view release on metacpan or search on metacpan
Allopass.pm view on Meta::CPAN
See I<http://www.allopass.com/index.php4?ADV=1508058> for more informations on their system and how it basically works.
=cut
use strict;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use CGI::Cookie;
my $baseurl = 'http://www.allopass.com/check/vf.php4';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/PinPayment.pm view on Meta::CPAN
package Business::PinPayment;
use strict;
use warnings;
use Net::SSL;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
our $VERSION = '0.04';
lib/Business/PinPayment.pm view on Meta::CPAN
else {
$url .= '/' . $api;
}
my $ua = LWP::UserAgent->new();
my $p = HTTP::Request->new(POST => $url);
$p->content_type('application/json');
$p->authorization_basic($api_key);
my $json_request = to_json( $self->{config}, {utf8 => 1} );
$p->content($json_request) unless $api eq 'refunds';
lib/Business/PinPayment.pm view on Meta::CPAN
Returns the error message.
=head2 C<response>
Returns the response of the L<HTTP::Request> object.
=head2 C<json_response>
Returns a hashref of the JSON response content.
lib/Business/PinPayment.pm view on Meta::CPAN
Returns the 'card_token'.
=head1 SEE ALSO
L<HTTP::Request>, L<LWP::UserAgent>, L<https://pin.net.au>
=head1 AUTHOR
Xufeng (Danny) Liang (danny.glue@gmail.com)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/Shipping/DataTools.pm view on Meta::CPAN
return unless $url and $file;
eval {
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $url);
open( NEW_ZONE_FILE, "> $file" );
print( NEW_ZONE_FILE $ua->request($req)->content() );
close( NEW_ZONE_FILE );
};
warn $@ if $@;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/Shipping/RateRequest/Online.pm view on Meta::CPAN
my $request_xml = $self->_gen_request_xml();
#trace( $request_xml );
info("gen_url = " . $self->_gen_url());
my $request = HTTP::Request->new('POST', $self->_gen_url());
$request->header('content-type' => 'application/x-www-form-urlencoded');
$request->header('content-length' => length($request_xml));
$request->content($request_xml);
return ($request);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/SiteCatalyst.pm view on Meta::CPAN
use warnings;
use Data::Dumper;
use Carp;
use LWP::UserAgent qw();
use HTTP::Request qw();
use JSON qw();
use Digest::MD5 qw();
use POSIX qw();
use Digest::SHA1 qw();
use MIME::Base64 qw();
lib/Business/SiteCatalyst.pm view on Meta::CPAN
my $password_digest = MIME::Base64::encode_base64(
Digest::SHA1::sha1_hex( $nonce . $created . $self->{'shared_secret'} )
);
chomp($password_digest);
my $request = HTTP::Request->new(POST => $url);
carp "POSTing request to URL >" . ( defined( $url ) ? $url : '' ) . "<"
if $verbose;
my $auth_header = qq|UsernameToken Username="$username", PasswordDigest="$password_digest", Nonce="$nonce", Created="$created"|;
carp "Auth header: >$auth_header<" if $verbose;
view all matches for this distribution
view release on metacpan or search on metacpan
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
use HTTP::Request::Common qw/DELETE GET POST/;
use MIME::Base64 qw(encode_base64);
our $VERSION = '0.07';
use constant URL => 'https://api.stripe.com/v1/';
},
);
=item C<-ua> Completely overrides the default user agent object (L<LWP::UserAgent>).
Note that your object I<must> accept HTTPS, and provide a C<request()> method
accepting L<HTTP::Request> objects and returning L<HTTP::Response>-compatible
objects. You can use this to have a common user agent make all requests in
your code. The example above works exactly like:
my $ua = LWP::UserAgent->new(
timeout => 10,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/TNT/ExpressConnect.pm view on Meta::CPAN
sub get_prices {
my ($self, $args) = @_;
my $user_agent = $self->user_agent;
my $req = HTTP::Request->new(POST => $self->tnt_get_price_url);
$req->authorization_basic($self->username, $self->password);
$req->header('Content-Type' => 'text/xml; charset=utf-8');
if (my $file = $args->{file}) {
$req->content('' . file($file)->slurp);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/Tax/Avalara.pm view on Meta::CPAN
use warnings;
use Try::Tiny;
use Carp;
use LWP;
use HTTP::Request::Common;
use Encode qw();
use Data::Dump;
use JSON::PP;
lib/Business/Tax/Avalara.pm view on Meta::CPAN
my $user_agent = LWP::UserAgent->new();
$user_agent->agent( "perl/Business-Tax-Avalara/$VERSION" );
$user_agent->timeout( $self->{'request_timeout'} );
# Create a request
my $request = HTTP::Request::Common::POST(
$request_url,
);
$request->authorization_basic(
$self->{'user_name'},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/Tax/VAT/Validation.pm view on Meta::CPAN
use strict;
use warnings;
our $VERSION = '1.24';
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use JSON qw/ decode_json /;
=head1 NAME
lib/Business/Tax/VAT/Validation.pm view on Meta::CPAN
}
sub _check_vies {
my ($self, $vatNumber, $countryCode) = @_;
my $ua = $self->_get_ua();
my $request = HTTP::Request->new(POST => $self->{baseurl});
$request->content(_in_soap_envelope($vatNumber, $countryCode));
$request->content_type("text/xml; charset=utf-8");
my $response = $ua->request($request);
lib/Business/Tax/VAT/Validation.pm view on Meta::CPAN
sub _check_hmrc {
my ($self, $vatNumber, $countryCode) = @_;
my $ua = $self->_get_ua();
my $request = HTTP::Request->new(GET => $self->{hmrc_baseurl}.$vatNumber);
$request->header(Accept => 'application/vnd.hmrc.1.0+json');
my $response = $ua->request($request);
$self->{res} = $response->decoded_content;
if ($response->code == 200) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/UTV.pm view on Meta::CPAN
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common;
use URI::Escape;
our $VERSION = 0.05;
our $errstr = undef;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/WebMoney.pm view on Meta::CPAN
our $VERSION = '0.11';
use Carp;
use LWP::UserAgent;
use XML::LibXML;
use HTTP::Request;
use File::Spec;
use POSIX();
sub new
{
lib/Business/WebMoney.pm view on Meta::CPAN
unless ($res_content = $req_fields->{debug_response}) {
my $ua = LWP::UserAgent->new;
$ua->timeout($self->{timeout} + 1);
my $req = HTTP::Request->new;
$req->method('POST');
$req->uri("https://w3s.wmtransfer.com/asp/XML$args{func}Cert.asp");
$req->content($req_data);
my ($res, $timeout);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Business/YQL.pm view on Meta::CPAN
package Business::YQL;
use Moo;
our $VERSION = '0.0004'; # VERSION
use HTTP::Request::Common qw(GET POST);
use URI;
use URI::QueryParam;
use LWP::UserAgent;
use JSON qw(to_json from_json);
use Carp qw(croak);
view all matches for this distribution
view release on metacpan or search on metacpan
t/testlib/HTTP.pm view on Meta::CPAN
package testlib::HTTP;
use strict;
use warnings;
use BusyBird::Util 'set_param';
use HTTP::Request;
use Test::More;
use Test::Builder;
use JSON qw(from_json);
use HTML::TreeBuilder 5 -weak;
use HTML::TreeBuilder::XPath;
t/testlib/HTTP.pm view on Meta::CPAN
}
sub request_ok {
my ($self, $method, $request_url, $content, $res_code_like, $msg) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $res = $self->{requester}->(HTTP::Request->new($method, $request_url, undef, $content));
if(defined $res_code_like) {
like($res->code, $res_code_like, $msg);
}
return $res->decoded_content(raise_error => 1);
}
view all matches for this distribution
view release on metacpan or search on metacpan
"File::ReadBackwards" : "0",
"File::Slurp" : "0",
"File::Spec" : "0",
"File::Temp" : "0",
"Gzip::Faster" : "0",
"HTTP::Request::Common" : "0",
"IPC::Cmd" : "0",
"JSON" : "0",
"LWP::UserAgent" : "0",
"MIME::Base64" : "0",
"Mojolicious::Lite" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CDDB.pm view on Meta::CPAN
# Determine whether we can use HTTP for requests and submissions.
my $imported_http = 0;
eval {
require LWP;
require HTTP::Request;
$imported_http = 1;
};
#------------------------------------------------------------------------------
# Send a command. If we're not connected, try to connect first.
view all matches for this distribution
view release on metacpan or search on metacpan
use Digest::SHA;
use Encode;
use Fcntl;
use HTTP::Date;
use HTTP::Headers;
use HTTP::Request;
use HTTP::Server::Simple;
use LWP::UserAgent;
use Time::Local;
use utf8;
package CDS;
$headers->header('Condensation-Date' => $date);
$headers->header('Condensation-Actor' => $keyPair->publicKey->hash->hex);
$headers->header('Condensation-Signature' => unpack('H*', $signature));
}
return LWP::UserAgent->new->request(HTTP::Request->new($method, $url, $headers, $data));
}
# Models a hash, and offers binary and hexadecimal representation.
package CDS::Hash;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Alternatives.pm view on Meta::CPAN
One major advantage of modern frameworks is testability. All the frameworks
mentioned support easy testing:
use Test::More;
use Plack::Test;
use HTTP::Request::Common;
my $app = MyApp->to_app;
test_psgi $app, sub {
my $cb = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Application/Dispatch/Server.pm view on Meta::CPAN
print $response->as_string;
}
}
# Shamelessly stolen from HTTP::Request::AsCGI by chansen
sub _build_response {
my ( $self, $stdout ) = @_;
$stdout =~ s{(.*?\x0d?\x0a\x0d?\x0a)}{}xsm;
my $headers = $1;
lib/CGI/Application/Dispatch/Server.pm view on Meta::CPAN
if you have found a bug, please report it through rt.cpan.org.
=head1 ACKNOWLEDGEMENTS
This module was cloned from L<CGI::Application::Server|CGI::Application::Server>, which in turn
borrowed significant parts from L<HTTP::Request::AsCGI|HTTP::Requeste::AsCGI>.
=head1 CONTRIBUTORS
George Hartzell E<lt>hartzell@alerce.comE<gt>
Mark Stosberg
view all matches for this distribution
view release on metacpan or search on metacpan
# make sure we can get to our modules
use lib 't/lib';
use Test::More 'no_plan';
use Plack::Test;
use HTTP::Request::Common;
use CGI::Application::Dispatch::PSGI;
use Module::Name;
use MyApp::Module::Name;
use MyApp::DispatchPSGI;
use MyApp::DispatchTablePSGI;
view all matches for this distribution
view release on metacpan or search on metacpan
my $ca = MyCGIApp->new;
$ca->run;
}),
client => sub {
my $cb = shift;
my $req = HTTP::Request->new(GET => 'http://localhost/');
my $res = $cb->($req);
is $res->code, 200, 'status code is 200';
is $res->content_type, 'application/x-hello-world', 'content-type';
is $res->content, 'hello world', 'body';
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Application/MailPage.pm view on Meta::CPAN
my $callback = $self->param('read_file_callback');
$buffer = $callback->($filename);
} elsif( $self->param('remote_fetch') && ($page =~ /^https?:\/\//) ) {
#fetch this page with LWP
require LWP::UserAgent;
require HTTP::Request;
my $agent = LWP::UserAgent->new();
my $response = $agent->request(HTTP::Request->new(GET => $page));
if( $response->is_success ) {
$buffer = $response->content();
} else {
return $self->error("Unable to retrieve remote page $page");
}
lib/CGI/Application/MailPage.pm view on Meta::CPAN
my $buffer = $callback->($filename);
push(@lines, split("\n", $buffer));
} elsif( $self->param('remote_fetch') && ($page =~ /^https?:\/\//) ) {
#fetch this page with LWP
require LWP::UserAgent;
require HTTP::Request;
my $agent = LWP::UserAgent->new();
my $response = $agent->request(HTTP::Request->new(GET => $page));
if( $response->is_success ) {
my $buffer = $response->content();
@lines = split(/\r?\n/, $buffer);
} else {
return $self->error("Unable to retrieve remote page $page");
lib/CGI/Application/MailPage.pm view on Meta::CPAN
my $callback = $self->param('read_file_callback');
$html_tree->parse( $callback->($filename) );
} elsif( $self->param('remote_fetch') && ($page =~ /^https?:\/\//) ) {
#fetch this page with LWP
require LWP::UserAgent;
require HTTP::Request;
my $agent = LWP::UserAgent->new();
my $response = $agent->request(HTTP::Request->new(GET => $page));
if( $response->is_success ) {
my $buffer = $response->content();
$html_tree->parse($buffer);
} else {
return $self->error("Unable to retrieve remote page $page");
view all matches for this distribution
view release on metacpan or search on metacpan
$res = $ua->post("http://127.0.0.1:$port/", { name => "baz" });
like $res->content, qr/Hello baz/;
like $res->content_type, qr/plain/;
$res = $ua->simple_request(HTTP::Request->new(GET => "http://127.0.0.1:$port/?rm=hello_redir"));
is $res->code, 302;
is $res->header('location'), '/foo';
},
server => sub {
my $port = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Application/Search.pm view on Meta::CPAN
# Search::Tools::HiLiter doesn't like blank searches so handle those on our own
if( -e $page ) {
$content = decode_utf8(read_file($page));
} else {
require HTTP::Request;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $request = HTTP::Request->new( GET => $page);
my $response = $ua->request($request);
if ( $response->is_error ) {
warn "Error: Couldn't get '$page': response code " . $response->code . "\n";
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Application/Server.pm view on Meta::CPAN
print $response->as_string();
return 1; # Like ...Simple::Static::serve_static does
}
# Shamelessly stolen from HTTP::Request::AsCGI by chansen
sub _build_response {
my ( $self, $stdout ) = @_;
$stdout =~ s{(.*?\x0d?\x0a\x0d?\x0a)}{}xsm;
my $headers = $1;
lib/CGI/Application/Server.pm view on Meta::CPAN
This is a subclass of L<HTTP::Server::Simple> and all of its caveats
apply here as well.
=head1 ACKNOWLEDGEMENTS
The HTTP response handling was shamelessly stolen from L<HTTP::Request::AsCGI>
by chansen
=head1 AUTHORS
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
AuthRegister.pm view on Meta::CPAN
print $HTMLstart, $LoginMsg; exit; }
if ($casurl !~ /^https:\/\//i) {
my $u = CGI::url(); $u=~ s/\/[^\/]+$//; $casurl = "$u/$casurl"; }
require LWP::UserAgent; require HTTP::Request; require Mozilla::CA;
my $ua = LWP::UserAgent->new();
use HTTP::Request::Common qw(POST);
my $req = POST $casurl, [ rt=>'verify', username=>$username, stoken=>$stoken ];
my $resp = $ua->request($req);
my $result = 'fail';
if ($resp->is_success) {
my $message = $resp->decoded_content; $message =~ s/\s//g;
view all matches for this distribution