$this->config['ssl_verify_peer'] = false;
}
+ // This means "verify the cert hostname against what we connect to", it does not
+ // imply CA trust or anything like that. Just the hostname.
+ $this->config['ssl_verify_host'] = common_config('http', 'ssl_verify_host');
+
if (common_config('http', 'curl') && extension_loaded('curl')) {
$this->config['adapter'] = 'HTTP_Request2_Adapter_Curl';
}
return new HTTPClient();
}
+ /**
+ * Quick static function to GET a URL
+ */
+ public static function quickGet($url, $accept=null)
+ {
+ $client = new HTTPClient();
+ if (!is_null($accept)) {
+ $client->setHeader('Accept', $accept);
+ }
+ $response = $client->get($url);
+ if (!$response->isOk()) {
+ // TRANS: Exception. %s is a profile URL.
+ throw new Exception(sprintf(_m('Could not GET URL %s.'), $url), $response->getStatus());
+ }
+ return $response->getBody();
+ }
+
/**
* Convenience function to run a GET request.
*