Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Php

Idiom #174 Make HTTP POST request

Make a HTTP request with method POST to the URL 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);

New implementation...
< >
programming-idioms.org