<?php function login($username, $password) { // Generate post string 'username' => $username, 'password' => $password, 'autologin' => 1, 'redirect' => 'index.php', 'login' => 'Zaloguj' )); // Definiowanie cURL'a $this->curl = curl_init(); // Set options curl_setopt ( $this->curl, CURLOPT_URL, $this->phpbb_url . 'login.php?redirect=index.php' ); curl_setopt ( $this->curl, CURLOPT_POST, true ); curl_setopt ($ch, CURLOPT_REFERER, "http://www.przykładowastrona.pl/forum/index.php"); curl_setopt ( $this->curl, CURLOPT_POSTFIELDS, $post_fields ); curl_setopt ( $this->curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt ( $this->curl, CURLOPT_HEADER, false ); curl_setopt ( $this->curl, CURLOPT_COOKIE, $this->cookie_name ); curl_setopt ( $this->curl, CURLOPT_COOKIEJAR, $this->cookie_name ); curl_setopt ( $this->curl, CURLOPT_COOKIEFILE, $this->cookie_name ); curl_setopt ( $this->curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4'); // Logowanie $result = curl_exec ( $this->curl ); // Diagnoza błędu if ( curl_errno ( $this->curl ) ) { curl_errno($this->curl), curl_error($this->curl), ); curl_close ( $this->curl ); return false; } // Rozłączanie curl_close ( $this->curl ); // Prawidłowy wynik return true; } ?>
No i gdy wywołam stworzonąfunkcję nie loguje mnie. Co jest nie tak? Wywala mi błąd w 8 linijce kodu