CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/request?foo=bar&foo=baz");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-pretty-print: 2");
headers = curl_slist_append(headers, "content-type: application/json");
headers = curl_slist_append(headers, "accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_COOKIE, "foo=bar; bar=baz");

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"foo\": \"bar\"}");

CURLcode ret = curl_easy_perform(hnd);
var client = new RestClient("http://mockbin.com/request?foo=bar&foo=baz");
var request = new RestRequest(Method.POST);
request.AddHeader("x-pretty-print", "2");
request.AddHeader("content-type", "application/json");
request.AddHeader("accept", "application/json");
request.AddCookie("foo", "bar");
request.AddCookie("bar", "baz");
request.AddParameter("application/json", "{\"foo\": \"bar\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://mockbin.com/request?foo=bar&foo=baz"

	payload := strings.NewReader("{\"foo\": \"bar\"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("cookie", "foo=bar; bar=baz")
	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")
	req.Header.Add("x-pretty-print", "2")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"foo\": \"bar\"}");
Request request = new Request.Builder()
  .url("http://mockbin.com/request?foo=bar&foo=baz")
  .post(body)
  .addHeader("cookie", "foo=bar; bar=baz")
  .addHeader("accept", "application/json")
  .addHeader("content-type", "application/json")
  .addHeader("x-pretty-print", "2")
  .build();

Response response = client.newCall(request).execute();
HttpResponse<String> response = Unirest.post("http://mockbin.com/request?foo=bar&foo=baz")
  .header("cookie", "foo=bar; bar=baz")
  .header("accept", "application/json")
  .header("content-type", "application/json")
  .header("x-pretty-print", "2")
  .body("{\"foo\": \"bar\"}")
  .asString();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://mockbin.com/request?foo=bar&foo=baz",
  "method": "POST",
  "headers": {
    "cookie": "foo=bar; bar=baz",
    "accept": "application/json",
    "content-type": "application/json",
    "x-pretty-print": "2"
  },
  "processData": false,
  "data": "{\"foo\": \"bar\"}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var data = JSON.stringify({
  "foo": "bar"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "http://mockbin.com/request?foo=bar&foo=baz");
xhr.setRequestHeader("cookie", "foo=bar; bar=baz");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("x-pretty-print", "2");

xhr.send(data);
var http = require("http");

var options = {
  "method": "POST",
  "hostname": "mockbin.com",
  "port": null,
  "path": "/request?foo=bar&foo=baz",
  "headers": {
    "cookie": "foo=bar; bar=baz",
    "accept": "application/json",
    "content-type": "application/json",
    "x-pretty-print": "2"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ foo: 'bar' }));
req.end();
var request = require("request");

var jar = request.jar();
jar.setCookie(request.cookie("foo=bar"), "http://mockbin.com/request");
jar.setCookie(request.cookie("bar=baz"), "http://mockbin.com/request");

var options = { method: 'POST',
  url: 'http://mockbin.com/request',
  qs: { foo: [ 'bar', 'baz' ] },
  headers: 
   { 'x-pretty-print': '2',
     'content-type': 'application/json',
     accept: 'application/json' },
  body: { foo: 'bar' },
  json: true,
  jar: 'JAR' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
var unirest = require("unirest");

var req = unirest("POST", "http://mockbin.com/request");

var CookieJar = unirest.jar();
CookieJar.add("foo=bar","http://mockbin.com/request");
CookieJar.add("bar=baz","http://mockbin.com/request");
req.jar(CookieJar);

req.query({
  "foo": [
    "bar",
    "baz"
  ]
});

req.headers({
  "x-pretty-print": "2",
  "content-type": "application/json",
  "accept": "application/json"
});

req.type("json");
req.send({
  "foo": "bar"
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
#import <Foundation/Foundation.h>

NSDictionary *headers = @{ @"cookie": @"foo=bar; bar=baz",
                           @"accept": @"application/json",
                           @"content-type": @"application/json",
                           @"x-pretty-print": @"2" };
NSDictionary *parameters = @{ @"foo": @"bar" };

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://mockbin.com/request?foo=bar&foo=baz"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "http://mockbin.com/request?foo=bar&foo=baz" in
let headers = Header.add_list (Header.init ()) [
  ("cookie", "foo=bar; bar=baz");
  ("accept", "application/json");
  ("content-type", "application/json");
  ("x-pretty-print", "2");
] in
let body = Cohttp_lwt_body.of_string "{\"foo\": \"bar\"}" in

Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://mockbin.com/request?foo=bar&foo=baz",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"foo\": \"bar\"}",
  CURLOPT_COOKIE => "foo=bar; bar=baz",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json",
    "x-pretty-print: 2"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
<?php

$request = new HttpRequest();
$request->setUrl('http://mockbin.com/request');
$request->setMethod(HTTP_METH_POST);

$request->setQueryData(array(
  'foo' => array(
    'bar',
    'baz'
  )
));

$request->setHeaders(array(
  'x-pretty-print' => '2',
  'content-type' => 'application/json',
  'accept' => 'application/json'
));

$request->setCookies(array(
  'bar' => 'baz',
  'foo' => 'bar'
));

$request->setBody('{"foo": "bar"}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"foo": "bar"}');

$request->setRequestUrl('http://mockbin.com/request');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setQuery(new http\QueryString(array(
  'foo' => array(
    'bar',
    'baz'
  )
)));

$request->setHeaders(array(
  'x-pretty-print' => '2',
  'content-type' => 'application/json',
  'accept' => 'application/json'
));


$client->setCookies(array(
  'bar' => 'baz',
  'foo' => 'bar'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
import http.client

conn = http.client.HTTPConnection("mockbin.com")

payload = "{\"foo\": \"bar\"}"

headers = {
    'cookie': "foo=bar; bar=baz",
    'accept': "application/json",
    'content-type': "application/json",
    'x-pretty-print': "2"
    }

conn.request("POST", "/request?foo=bar&foo=baz", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "http://mockbin.com/request"

querystring = {"foo":["bar","baz"]}

payload = "{\"foo\": \"bar\"}"
headers = {
    'cookie': "foo=bar; bar=baz",
    'accept': "application/json",
    'content-type': "application/json",
    'x-pretty-print': "2"
    }

response = requests.request("POST", url, data=payload, headers=headers, params=querystring)

print(response.text)
require 'uri'
require 'net/http'

url = URI("http://mockbin.com/request?foo=bar&foo=baz")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["cookie"] = 'foo=bar; bar=baz'
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["x-pretty-print"] = '2'
request.body = "{\"foo\": \"bar\"}"

response = http.request(request)
puts response.read_body
curl --request POST \
  --url 'http://mockbin.com/request?foo=bar&foo=baz' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-pretty-print: 2' \
  --cookie 'foo=bar; bar=baz' \
  --data '{"foo": "bar"}'
echo '{"foo": "bar"}' |  \
  http POST 'http://mockbin.com/request?foo=bar&foo=baz' \
  accept:application/json \
  content-type:application/json \
  cookie:'foo=bar; bar=baz' \
  x-pretty-print:2
wget --quiet \
  --method POST \
  --header 'cookie: foo=bar; bar=baz' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-pretty-print: 2' \
  --body-data '{"foo": "bar"}' \
  --output-document \
  - 'http://mockbin.com/request?foo=bar&foo=baz'
import Foundation

let headers = [
  "cookie": "foo=bar; bar=baz",
  "accept": "application/json",
  "content-type": "application/json",
  "x-pretty-print": "2"
]
let parameters = ["foo": "bar"]

let postData = NSJSONSerialization.dataWithJSONObject(parameters, options: nil, error: nil)

var request = NSMutableURLRequest(URL: NSURL(string: "http://mockbin.com/request?foo=bar&foo=baz")!,
                                        cachePolicy: .UseProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.HTTPMethod = "POST"
request.allHTTPHeaderFields = headers
request.HTTPBody = postData

let session = NSURLSession.sharedSession()
let dataTask = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    println(error)
  } else {
    let httpResponse = response as? NSHTTPURLResponse
    println(httpResponse)
  }
})

dataTask.resume()