protected function instantiateNewClient() { $drupalPassword = $this->remote_site_password ? $this->remote_site_password : getenv('DRUPAL_REMOTE_CLIENT_PASSWORD'); $drupalUser = $this->remote_site_username ? $this->remote_site_username : getenv('DRUPAL_REMOTE_CLIENT_USERNAME'); $drupalUrl = $this->base_url_for_remote_client ? $this->base_url_for_remote_client : getenv('DRUPAL_REMOTE_CLIENT_URL'); $drupalRemoteClient = new Client(); $drupalRemoteClient->setOption('base_url', $drupalUrl); $drupalRemoteClient->authenticate($drupalUser, $drupalPassword, 'http_drupal_login', $this->request_cookie); // @TODO - Make logging optional $drupalRemoteClient->logging(); return $drupalRemoteClient; }