Solicitud http perl

Ejemplos de código

1
0

solicitud http perl

#!/usr/bin/env perl 
use strict;
use warnings; 
use Encode qw(encode_utf8);
use HTTP::Request ();
use JSON::MaybeXS qw(encode_json);
my $url = 'https://www.example.com/api/user/123';
my $header = ['Content-Type' => 'application/json; charset=UTF-8'];
my $data = {foo => 'bar', baz => 'quux'};
my $encoded_data = encode_utf8(encode_json($data));
my $r = HTTP::Request->new('POST', $url, $header, $encoded_data);
# at this point, we could send it via LWP::UserAgent
# my $ua = LWP::UserAgent->new();
# my $res = $ua->request($r);
0
0

solicitud http perl

#!/usr/bin/env perl use strict;use warnings; use Encode qw(encode_utf8);use HTTP::Request ();use JSON::MaybeXS qw(encode_json); my $url = 'https://www.example.com/api/user/123';my $header = ['Content-Type' => 'application/json; charset=UTF-8'];my $data = {foo => 'bar', baz => 'quux'};my $encoded_data = encode_utf8(encode_json($data)); my $r = HTTP::Request->new('POST', $url, $header, $encoded_data);# at this point, we could send it via LWP::UserAgent# my $ua = LWP::UserAgent->new();# my $res = $ua->request($r);

Páginas relacionadas

Páginas de ejemplo relacionadas

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................