$value) { $data[$key] = urlencode($key) . '=' . urlencode($value); } return implode('&', $data); } function curluj($url) { $c = curl_init(); curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); //SSL curl_setopt($c, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookie_orange.txt'); curl_setopt($c, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookie_orange.txt'); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1'); curl_setopt($c, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($c, CURLOPT_VERBOSE, 0); curl_setopt($c, CURLOPT_HEADER, 0); $Result = curl_exec($c); curl_close($c); return iconv("UTF-8", "cp1250", $Result); } $data = array( '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.x' => 27, '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.y' => 19, '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL' => "http://www.orange.pl/portal/map/map/signin", '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL' => "http://www.orange.pl/portal/map/map/your_account", '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.redirectOriginUrl' => "http://www.orange.pl/portal/map/map/your_account", '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.requestURL' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login' => $login, '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password' => $password, '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login' => '', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL' => '' , '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL' => '', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.redirectOriginUrl' => '', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.requestURL' => '', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login' => '', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password' => '', '_DARGS' => '/gear/static/signInLoginBox.jsp', '_dyncharset' => 'UTF-8', ); if (!preg_match("/jeste. ju. zalogowan/i", curluj('http://www.orange.pl/portal/zaloguj.phtml'))) { if (!curluj('http://www.orange.pl/')) { echo "Błąd\n\nSerwer Orange.pl nie odpowiada."; exit(0); } $url = 'https://www.orange.pl/zaloguj.phtml?_DARGS=/gear/static/signInLoginBox.jsp'; $params = createPostString($data); $c = curl_init(); curl_setopt($c, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookie_orange.txt'); curl_setopt($c, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookie_orange.txt'); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_POST,1); curl_setopt($c, CURLOPT_POSTFIELDS,$params); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1'); curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false); //SSL $Result = curl_exec($c); curl_close($c); if (!preg_match('/