Search
 
SCRIPT & CODE EXAMPLE
 

PERL

perl http request

#!/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);
Comment

perl http request

#!/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);
Comment

PREVIOUS NEXT
Code Example
Perl ::  
:: nested haah in perl 
::  
::  
::  
::  
:: powershell display firewall rules name 
::  
Gdscript ::  
::  
::  
Cobol :: gatsby with yarn 
:: 64 bit assembly Hello world 
:: Z language latex 
Assembly :: tqdm iterate over range 
::  
::  
::  
::  
Javascript ::  
Javascript ::  
::  
::  
::  
Javascript ::  
:: location reload after 2 seconds 
::  
:: js mouse position relative to element 
::  
:: disable right click javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =