11 public function __construct($cfg)
16 public static function opts(\Console_CommandLine $optParser)
18 $cmd = $optParser->addCommand('like');
23 'description' => 'URL that is liked',
28 public function run($command)
30 $url = Validator::url($command->args['url'], 'url');
35 $body = http_build_query(
42 $req = new Request($this->cfg->host, $this->cfg);
43 $res = $req->send($body);
44 $postUrl = $res->getHeader('Location');
45 if ($postUrl === null) {
46 Log::err('Error: Server sent no "Location" header and said:');
47 Log::err($res->getBody());
50 echo "Like created at server\n";