X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FBlogspamNetPlugin.php;h=51236001aa3fb9aca78ed0a65de62a4a299c7622;hb=a85a3ddc725a99ea182e86ec65f6be574752b18f;hp=d9372bcd56a42ad57bc5b67b3f06e54cf07b712c;hpb=cca1d777485d9b5f41bbc65ad10b002702f0aae4;p=quix0rs-gnu-social.git diff --git a/plugins/BlogspamNetPlugin.php b/plugins/BlogspamNetPlugin.php index d9372bcd56..51236001aa 100644 --- a/plugins/BlogspamNetPlugin.php +++ b/plugins/BlogspamNetPlugin.php @@ -1,6 +1,6 @@ . * * @category Plugin - * @package Laconica - * @author Evan Prodromou - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @author Brion Vibber + * @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://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET')) { exit(1); } @@ -45,10 +46,10 @@ define('BLOGSPAMNETPLUGIN_VERSION', '0.1'); * hits, but it's better than nothing. * * @category Plugin - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * * @see Event */ @@ -69,14 +70,12 @@ 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 = HTTPClient::start(); + $httpResponse = $request->post($this->baseUrl, array('Content-Type: text/xml'), $requestBody); + + $response = xmlrpc_decode($httpResponse->getBody()); if (xmlrpc_is_fault($response)) { throw new ServerException("$response[faultString] ($response[faultCode])", 500); } else { @@ -139,6 +138,6 @@ class BlogspamNetPlugin extends Plugin function userAgent() { - return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' Laconica/' . LACONICA_VERSION; + return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION; } }