8 public function __construct($host)
10 $this->req = new \HTTP_Request2($host->endpoints->micropub, 'POST');
11 if (version_compare(PHP_VERSION, '5.6.0', '<')) {
12 //correct ssl validation on php 5.5 is a pain, so disable
13 $this->req->setConfig('ssl_verify_host', false);
14 $this->req->setConfig('ssl_verify_peer', false);
16 $this->req->setHeader('Content-type', 'application/x-www-form-urlencoded');
17 $this->req->setHeader('Authorization', 'Bearer ' . $host->token);
20 public function send($body)
22 $this->req->setBody($body);
23 $res = $this->req->send();
24 if (intval($res->getStatus() / 100) != 2) {
26 'Server returned an error status code ' . $res->getStatus()
28 Log::err($res->getBody());