11 public function __construct($host)
16 public function run($url)
18 $url = Validator::url($url, 'url');
23 $body = http_build_query(
30 $req = new \HTTP_Request2($this->host->endpoints->micropub, 'POST');
31 $req->setHeader('Content-type', 'application/x-www-form-urlencoded');
32 $req->setHeader('Authorization', 'Bearer ' . $this->host->token);
35 if (intval($res->getStatus() / 100) != 2) {
37 'Server returned an error status code ' . $res->getStatus()
39 Log::err($res->getBody());
42 $postUrl = $res->getHeader('Location');
43 echo "Like created at server\n";