Services_Hoptoad::pearRequest PHP Method

pearRequest() public method

Send the request to Hoptoad using PEAR
Author: Rich Cavanaugh
public pearRequest ( $url, $headers, $body ) : integer
return integer
    public function pearRequest($url, $headers, $body)
    {
        if (!class_exists('HTTP_Request2')) {
            require_once 'HTTP/Request2.php';
        }
        if (!class_exists('HTTP_Request2_Adapter_Socket')) {
            require_once 'HTTP/Request2/Adapter/Socket.php';
        }
        $adapter = new HTTP_Request2_Adapter_Socket();
        $req = new HTTP_Request2($url, HTTP_Request2::METHOD_POST);
        $req->setAdapter($adapter);
        $req->setHeader($headers);
        $req->setBody($body);
        return $req->send()->getStatus();
    }