Skip to content

Commit

Permalink
fixed post to work properly
Browse files Browse the repository at this point in the history
  • Loading branch information
pincombe committed Jan 17, 2013
1 parent 00946c3 commit a46a8b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Transmit/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a46a8b5

Please sign in to comment.