_host = $host; } final public function getHost(): string { return $this->_host; } final public function getClient(): Client { if ($this->_client === null) { $this->_client = new Client(['verify' => false]); } return $this->_client; } final public function getCookieJar() { if ($this->_cookieJar === null) { $this->_cookieJar = new CookieJar(); } return $this->_cookieJar; } final public function getDebug(): bool { return $this->_debug; } final public function setDebug(bool $debug): void { $this->_debug = $debug; } final public function getContent(string $url): string { return $this->getClient()->get($this->gethost() . $url)->getBody(); } // 로그인 메서드 final public function login($url, $username, $password) { try { $response = $this->getClient()->post($this->gethost() . $url, [ 'form_params' => [ 'username' => $username, 'password' => $password, ], 'cookies' => $this->getCookieJar(), ]); if ($response->getStatusCode() == 200) { log_message("info", "로그인 성공!"); return true; } else { log_message("info", "로그인 실패: " . $response->getStatusCode()); return false; } } catch (\Exception $e) { log_message("error", "로그인 중 오류 발생: " . $e->getMessage()); return false; } } }