diff --git a/src/Transmit/Client.php b/src/Transmit/Client.php index c74defe..efef7e1 100644 --- a/src/Transmit/Client.php +++ b/src/Transmit/Client.php @@ -31,15 +31,16 @@ private function request($uri, $type = 'GET', $post_data = '') { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->hostname . $uri); - curl_setopt($ch, CURLOPT_HTTPHEADER, array(sprintf('Key: %s', $this->key))); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_TIMEOUT, self::TIMEOUT); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if ($type == 'POST') { - curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); } + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', sprintf('Key: %s', $this->key))); + curl_setopt($ch, CURLOPT_TIMEOUT, self::TIMEOUT); + $response = curl_exec($ch); curl_close($ch); return $response;