Services_Hoptoad::curlRequest PHP Method

curlRequest() public method

Send the request to Hoptoad using Curl
Author: Rich Cavanaugh
public curlRequest ( $url, $headers, $body ) : integer
return integer
    public function curlRequest($url, $headers, $body)
    {
        $header_strings = array();
        foreach ($headers as $key => $val) {
            $header_strings[] = "{$key}: {$val}";
        }
        $curlHandle = curl_init();
        curl_setopt($curlHandle, CURLOPT_URL, $url);
        curl_setopt($curlHandle, CURLOPT_POST, 1);
        curl_setopt($curlHandle, CURLOPT_HEADER, 0);
        curl_setopt($curlHandle, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $body);
        curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $header_strings);
        curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
        curl_exec($curlHandle);
        $status = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
        curl_close($curlHandle);
        return $status;
    }