diff options
author | Sarven Capadisli <csarven@status.net> | 2009-11-02 14:53:31 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-11-02 14:53:31 +0000 |
commit | 8a07c7d7c021693271d1856f15dfe0abd9461d5d (patch) | |
tree | 1846465919fd94a2056c0154782d687242285fd6 /plugins/BlogspamNetPlugin.php | |
parent | ebd604cf6b6fda6823437cafc1d2db3eb23d9f41 (diff) | |
parent | fa37967858c3c29000797e510e5f98aca8ab558f (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/BlogspamNetPlugin.php')
-rw-r--r-- | plugins/BlogspamNetPlugin.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/BlogspamNetPlugin.php b/plugins/BlogspamNetPlugin.php index c14569746..3bdc73556 100644 --- a/plugins/BlogspamNetPlugin.php +++ b/plugins/BlogspamNetPlugin.php @@ -22,6 +22,7 @@ * @category Plugin * @package StatusNet * @author Evan Prodromou <evan@status.net> + * @author Brion Vibber <brion@status.net> * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ @@ -69,14 +70,14 @@ class BlogspamNetPlugin extends Plugin { $args = $this->testArgs($notice); common_debug("Blogspamnet args = " . print_r($args, TRUE)); - $request = xmlrpc_encode_request('testComment', array($args)); - $context = stream_context_create(array('http' => array('method' => "POST", - 'header' => - "Content-Type: text/xml\r\n". - "User-Agent: " . $this->userAgent(), - 'content' => $request))); - $file = file_get_contents($this->baseUrl, false, $context); - $response = xmlrpc_decode($file); + $requestBody = xmlrpc_encode_request('testComment', array($args)); + + $request = new HTTPClient($this->baseUrl, HTTP_Request2::METHOD_POST); + $request->addHeader('Content-Type: text/xml'); + $request->setBody($requestBody); + $httpResponse = $request->send(); + + $response = xmlrpc_decode($httpResponse->getBody()); if (xmlrpc_is_fault($response)) { throw new ServerException("$response[faultString] ($response[faultCode])", 500); } else { |