public function authorizeRemote($input)
{
$client = new GuzzleClient($input['remote_url']);
$client->setSslVerification(FALSE);
$cookieJar = new ArrayCookieJar();
// Create a new cookie plugin
$cookiePlugin = new CookiePlugin($cookieJar);
// Add the cookie plugin to the client
$client->addSubscriber($cookiePlugin);
$post_data = array('username' => $input['username'], 'password' => $input['password'], 'remember' => 'checked', 'api' => true);
$response = $client->post('login/backend', array(), $post_data)->send();
$response_json = $response->json();
if (isset($response_json['error'])) {
throw new Exception($response_json['error']);
}
return $client;
}