4 class Command_Like extends Command_AbstractProps
11 public function __construct($cfg)
16 public static function opts(\Console_CommandLine $optParser)
18 $cmd = $optParser->addCommand('like');
19 static::optsGeneric($cmd);
24 'description' => 'URL that is liked',
29 public function run(\Console_CommandLine_Result $cmdRes)
31 $url = Validator::url($cmdRes->args['url'], 'url');
36 $req = new Request($this->cfg->host, $this->cfg);
37 $req->req->addPostParameter('h', 'entry');
38 $req->req->addPostParameter('like-of', $url);
40 $this->handleGenericOptions($cmdRes, $req);
43 $postUrl = $res->getHeader('Location');
44 if ($postUrl === null) {
45 Log::err('Error: Server sent no "Location" header and said:');
46 Log::err($res->getBody());
49 echo "Like created at server\n";