curl --request GET \
  --url 'http://api.rajaongkir.com/starter/city?id=39&province=5' \
  --header 'key: your-api-key'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.rajaongkir.com/starter/city?id=39&province=5",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "key: your-api-key"
  ),
));

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

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
require 'uri'
require 'net/http'

url = URI("http://api.rajaongkir.com/starter/city?id=39&province=5")

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

request = Net::HTTP::Get.new(url)
request["key"] = 'your-api-key'

response = http.request(request)
puts response.read_body
#import <Foundation/Foundation.h>

NSDictionary *headers = @{ @"key": @"your-api-key" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://api.rajaongkir.com/starter/city?id=39&province=5"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];

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];
import Foundation

let headers = ["key": "your-api-key"]

var request = NSMutableURLRequest(URL: NSURL(string: "http://api.rajaongkir.com/starter/city?id=39&province=5")!,
                                        cachePolicy: .UseProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.HTTPMethod = "GET"
request.allHTTPHeaderFields = headers

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()
import http.client

conn = http.client.HTTPConnection("api.rajaongkir.com")

headers = { 'key': "your-api-key" }

conn.request("GET", "/starter/city?id=39&province=5", headers=headers)

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

print(data.decode("utf-8"))
package main

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

func main() {

	url := "http://api.rajaongkir.com/starter/city?id=39&province=5"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("key", "your-api-key")

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

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

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

}
var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.rajaongkir.com",
  "port": null,
  "path": "/starter/city?id=39&province=5",
  "headers": {
    "key": "your-api-key"
  }
};

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.end();
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.rajaongkir.com/starter/city?id=39&province=5")
  .get()
  .addHeader("key", "your-api-key")
  .build();

Response response = client.newCall(request).execute();