Exemplo n.º 1
0
 /**
  * Construct
  * @param string $apiKey API Key Anda sebagaimana yang tercantum di akun panel RajaOngkir
  * @param string[] $additionalHeaders Header tambahan seperti android-key, ios-key, dll
  */
 public function __construct($apiKey, $additionalHeaders = [])
 {
     self::$apiKey = $apiKey;
     $this->rest = new RESTClient();
     $this->rest->initialize(array('server' => self::$host));
     $this->rest->set_header('Content-Type', 'application/x-www-form-urlencoded');
     $this->rest->set_header('key', self::$apiKey);
     foreach ($additionalHeaders as $key => $value) {
         $this->restrest->set_header($key, $value);
     }
 }