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/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
view release on metacpan or search on metacpan
my $ua = LWP::UserAgent->new(conn_cache => LWP::ConnCache->new());
$ua->agent($0);
# Turn off proxy, because the proxy may not pass on all
# information back to here. Squid does that :-(
$ua->no_proxy($ARGV[0]);
my $request = HTTP::Request->new(GET => $ARGV[0]);
$request->protocol('HTTP/1.1');
# HTTP::Response object
my $r = $ua->request($request);
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More;
use CGI::Compile;
use CGI;
use Test::Requires qw(CGI::Emulate::PSGI Plack::Test HTTP::Request::Common);
use CGI::Emulate::PSGI;
use Plack::Test;
use HTTP::Request::Common;
my $sub = CGI::Compile->compile("t/hello.cgi");
my $app = CGI::Emulate::PSGI->handler($sub);
test_psgi app => $app, client => sub {
view all matches for this distribution
view release on metacpan or search on metacpan
t/05_lint.t view on Meta::CPAN
use strict;
use Test::More;
use Test::Requires qw( Plack::Test HTTP::Request Plack::Middleware::Lint );
use Test::Requires {
'Plack' => 0.9981,
};
use CGI::Emulate::PSGI;
t/05_lint.t view on Meta::CPAN
my $app = CGI::Emulate::PSGI->handler(sub { print $output });
$app = Plack::Middleware::Lint->wrap($app);
Plack::Test::test_psgi($app, sub {
my $cb = shift;
my $res = $cb->(HTTP::Request->new(GET => "/"));
is $res->code, 302;
});
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/testjson.pl view on Meta::CPAN
use autodie qw(:all);
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $req = HTTP::Request->new(POST => 'https://localhost/cgi-bin/info.pl');
$req->header('content-type' => 'application/json');
$req->content('{ "first": "Nigel", "last": "Horne" }');
my $resp = $ua->request($req);
if($resp->is_success()) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/090.14838.t view on Meta::CPAN
BEGIN {
if ( !$Config{d_fork} ) {
plan skip_all => "fork not available on this platform";
}
eval "use HTTP::Request::Common";
plan skip_all => "HTTP::Request::Common not available"
if $@;
plan tests => 1;
}
my $req = HTTP::Request::Common::POST(
'/dummy_location',
Content_Type => 'form-data',
Content => [ test_file => ["t/090.14838.t"], ]
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Untaint/Facebook.pm view on Meta::CPAN
return 0;
}
$url = $value;
}
my $request = HTTP::Request->new('HEAD' => $url);
$request->header('Accept' => 'text/html');
if($ENV{'HTTP_ACCEPT_LANGUAGE'}) {
$request->header('Accept-Language' => $ENV{'HTTP_ACCEPT_LANGUAGE'});
}
my $browser = LWP::UserAgent->new();
view all matches for this distribution