summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-09-15 22:14:15 -0400
committerEvan Prodromou <evan@status.net>2009-09-15 22:14:15 -0400
commit2f97531a49c042a0a900edb31f067a3c9f32967f (patch)
tree266c5bbe7d5a509494765774d43b9426bade44a9
parentf8a8c14b550a3ac3a4b3a17c53559056f70409b2 (diff)
add post to curlclient
-rw-r--r--lib/curlclient.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/curlclient.php b/lib/curlclient.php
index 99c3b6aa4..c43bfb57f 100644
--- a/lib/curlclient.php
+++ b/lib/curlclient.php
@@ -88,8 +88,27 @@ class CurlClient extends HTTPClient
return $this->parseResults($result);
}
- function post($url, $headers=null)
+ function post($url, $headers=null, $body=null)
{
+ $ch = curl_init($url);
+
+ $this->setup($ch);
+
+ curl_setopt($ch, CURLOPT_POST, true);
+
+ if (!is_null($body)) {
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
+ }
+
+ if (!is_null($headers)) {
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+ }
+
+ $result = curl_exec($ch);
+
+ curl_close($ch);
+
+ return $this->parseResults($result);
}
function setup($ch)