Programming-Idioms

Implementation
Python

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import "net/http"
response, err := http.Post(u, contentType, body)
import std.net.curl; 
auto response = post(u, content);
fphttpclient
with TFPHTTPClient.Create(nil) do
begin
 Post(u);
 Free;
end;
fetch(u, {
        method: "POST",
	body: JSON.stringify(data)
})
require "net/http"
Net::HTTP.post(u, content)
import "net/http"
import "net/url"
response, err := http.PostForm(u, formValues)
perl -Mojo -E 'my $u = "www.example.com"; say p($u)->body;'
use LWP::UserAgent;
# Create a user agent object

my $ua = LWP::UserAgent->new;
 
# Create a request
my $req = HTTP::Request->new(POST => $u);
 
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
 
# Check the outcome of the response
if ($res->is_success) {
    print $res->content;
}
else {
    print $res->status_line, "\n";
}
my $response = `curl -X POST $u`;
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $u); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_POST, 1);
$output = curl_exec($ch); 
curl_close($ch);
using System.Net.Http;
new HttpClient().PostAsync(u, content);
import 'package:http/http.dart';
await post(u, body: body, headers: headers);