![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Doł±czył: 7.08.2006 Ostrzeżenie: (0%) ![]() ![]() |
Teorytycznie skrypt powiniene dzialac ale wyskakuje mi blad w 33 linijce nie wiem dlaczego ?!
Poradzcie cos:-) |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 214 Pomógł: 18 Doł±czył: 25.04.2009 Ostrzeżenie: (20%) ![]() ![]() |
bo <br /> który jest w lini 31/32 nie jest poleceniem PHP
Kod <?PHP header("Content-type: text/html; charset=UTF-8"); /** * Licencja CC BY-NC-SA * <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.pl" target="_blank">http://creativecommons.org/licenses/by-nc-sa/3.0/deed.pl</a> * Klasa mbox umożliwiająca wysyłanie wiadomoœci SMS * @author Kacper 'kacka' Szurek * @mail kacperszurek (poczta w gmail.com) * Jeżeli się przydało - napisz * Chcesz podziękować, pomóc masz pytanie - napisz * Skrypt przechowuje cookie w katalogu /dane/mbox.txt * */ class mbox { /** * Przechowuje identyfikator połączenia curl * * @var $ch */ protected $_curl; /** * Ułatwienie dostępu do curl * * @param string $url - adres strony * @param array $post - opcjonalnie tablica parametrów * @return string - zwraca pobraną treœć */ public function curl($url, $post = null) { $this->_curl = curl_init(); $var = array( CURLOPT_URL => $url, CURLOPT_COOKIEJAR => dirname(__FILE__).'/dane/mbox.txt', CURLOPT_COOKIEFILE => dirname(__FILE__).'/dane/mbox.txt', CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6', CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true); if ( !is_null($post) ) { foreach ($post as $option => $value) { $tmp .= $option. '=' .urlencode($value). '&'; } $var[CURLOPT_POST] = true; $var[CURLOPT_POSTFIELDS] = $tmp; } curl_setopt_array($this->_curl, $var); $return = curl_exec($this->_curl); return $return; curl_close($this->_curl); } /** * Funkcja logująca do <span class="searchlite">orange</span>.pl * * @param string $user - użytkownik * @param string $password - hasło */ public function login($user, $password) { $data = array( '_dyncharset' => 'UTF-8', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL' => 'http://www.orange.pl/portal/map/map/signin', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL=' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL' => 'http://www.orange.pl/portal/map/map/pim', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login' => $user, '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password' => $password, '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.x' => 10, '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.y' => 10, '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login' => '', '&_DARGS' => '/gear/static/signInLoginBox.jsp' ); $login = $this->curl('http://www.orange.pl/portal/map/map/signin', $data); if (preg_match('/Podałeœ błędny login lub hasło. SprawdŸ je i wpisz jeszcze raz/', $login)) { file_put_contents('/dane/mbox.txt', ''); throw new Exception('Błędne dane logowania.'); } } /** * Funkcja wysyłająca sms, sprawdza jego długoœć i poprawnoœć numeru * * @param int $to - adres odbiorcy * @param string $message - treœć wiadomoœci */ public function send($to, $message) { if (strlen($message) == 0 || strlen($message) > 640) { throw new Exception('Wiadomoœć musi mieć mniej niż 640 znaków'); } $data = array( '_dyncharset' => 'UTF-8', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.type' => 'sms', '&_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.type' => '', 'enabled' => 'false', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.errorURL' => '/portal/map/map/message_box?mbox_view=newsms', '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.errorURL' => '', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.successURL' => '/portal/map/map/message_box?mbox_view=messageslist', '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.successURL' =>'', 'smscounter' => 1, 'counter' => strlen($message), '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.to' => $to, '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.to' => '', '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.body' => '', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.body' => $message, '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create' => '', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create' => 'Wyœlij', '_DARGS' => '/gear/mapmessagebox/smsform.jsp', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create.x' => 10, '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create.y' => 10 ); $send = $this->curl('http://www.orange.pl/portal/map/map/message_box?_DARGS=/gear/mapmessagebox/smsform.jsp', $data); if (preg_match('/Niepoprawny numer telefonu/', $send)) { throw new Exception('Podany numer telefonu jest błędny'); } if (preg_match('/Wyszukaj wiadomoœci, których/', $send)) { echo 'Wiadomoœć została prawidłowo wysłana.'; } } } try { if (!isset($_POST['login'])) { echo '<form method="post" action="mbox2.php5">Login:<input type="text" name="login"> Hasło:<input type="password" name="haslo"> Do kogo:<input type="text" name="do"> Wiadomoœć:<textarea name="tresc" rows="10" cols="40"></textarea><input type="submit" name="wyslij" value="Wyœlij"></form>'; } else { $a = new mbox(); $a->login($_POST['login'], $_POST['haslo']); $a->send($_POST['do'], $_POST['tresc']); } } catch (Exception $e) { echo $e->getMessage(); } ?> widzę że jest to skrypt do logowanej bramki SMS w orange ![]() -------------------- |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Doł±czył: 7.08.2006 Ostrzeżenie: (0%) ![]() ![]() |
tak to bra,ka sms w orange ;]
niestety po usunieciu <br> nadal nie chce dzialac w tym miejscu. nie wiem dlaczego widzi blad w $this->_curl = curl_init(); Ten post edytował efrem 11.05.2009, 02:13:31 |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 214 Pomógł: 18 Doł±czył: 25.04.2009 Ostrzeżenie: (20%) ![]() ![]() |
a masz na serwerze curl?, zobacz to
Kod <?PHP
header("Content-type: text/html; charset=UTF-8"); /** * Licencja CC BY-NC-SA * <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.pl" target="_blank">http://creativecommons.org/licenses/by-nc-sa/3.0/deed.pl</a> * Klasa mbox umożliwiająca wysyłanie wiadomoœci SMS * @author Kacper 'kacka' Szurek * @mail kacperszurek (poczta w gmail.com) * Jeżeli się przydało - napisz * Chcesz podziękować, pomóc masz pytanie - napisz * Skrypt przechowuje cookie w katalogu /dane/mbox.txt * */ class mbox { /** * Przechowuje identyfikator połączenia curl * * @var $ch */ protected $_curl; /** * Ułatwienie dostępu do curl * * @param string $url - adres strony * @param array $post - opcjonalnie tablica parametrów * @return string - zwraca pobraną treœć */ public function curl($url, $post = null) { if(!function_exists(curl_init)) die('cURL nie zosal zainstalowany'); $this->_curl = curl_init(); $var = array( CURLOPT_URL => $url, CURLOPT_COOKIEJAR => dirname(__FILE__).'/dane/mbox.txt', CURLOPT_COOKIEFILE => dirname(__FILE__).'/dane/mbox.txt', CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6', CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true); if ( !is_null($post) ) { foreach ($post as $option => $value) { $tmp .= $option. '=' .urlencode($value). '&'; } $var[CURLOPT_POST] = true; $var[CURLOPT_POSTFIELDS] = $tmp; } curl_setopt_array($this->_curl, $var); $return = curl_exec($this->_curl); return $return; curl_close($this->_curl); } /** * Funkcja logująca do <span class="searchlite">orange</span>.pl * * @param string $user - użytkownik * @param string $password - hasło */ public function login($user, $password) { $data = array( '_dyncharset' => 'UTF-8', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL' => 'http://www.orange.pl/portal/map/map/signin', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL=' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL' => 'http://www.orange.pl/portal/map/map/pim', '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login' => $user, '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password' => $password, '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password' => '', '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.x' => 10, '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.y' => 10, '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login' => '', '&_DARGS' => '/gear/static/signInLoginBox.jsp' ); $login = $this->curl('http://www.orange.pl/portal/map/map/signin', $data); if (preg_match('/Podałeœ błędny login lub hasło. SprawdŸ je i wpisz jeszcze raz/', $login)) { file_put_contents('/dane/mbox.txt', ''); throw new Exception('Błędne dane logowania.'); } } /** * Funkcja wysyłająca sms, sprawdza jego długoœć i poprawnoœć numeru * * @param int $to - adres odbiorcy * @param string $message - treœć wiadomoœci */ public function send($to, $message) { if (strlen($message) == 0 || strlen($message) > 640) { throw new Exception('Wiadomoœć musi mieć mniej niż 640 znaków'); } $data = array( '_dyncharset' => 'UTF-8', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.type' => 'sms', '&_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.type' => '', 'enabled' => 'false', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.errorURL' => '/portal/map/map/message_box?mbox_view=newsms', '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.errorURL' => '', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.successURL' => '/portal/map/map/message_box?mbox_view=messageslist', '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.successURL' =>'', 'smscounter' => 1, 'counter' => strlen($message), '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.to' => $to, '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.to' => '', '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.body' => '', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.body' => $message, '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create' => '', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create' => 'Wyœlij', '_DARGS' => '/gear/mapmessagebox/smsform.jsp', '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create.x' => 10, '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create.y' => 10 ); $send = $this->curl('http://www.orange.pl/portal/map/map/message_box?_DARGS=/gear/mapmessagebox/smsform.jsp', $data); if (preg_match('/Niepoprawny numer telefonu/', $send)) { throw new Exception('Podany numer telefonu jest błędny'); } if (preg_match('/Wyszukaj wiadomoœci, których/', $send)) { echo 'Wiadomoœć została prawidłowo wysłana.'; } } } try { if (!isset($_POST['login'])) { echo '<form method="post" action="mbox2.php5">Login:<input type="text" name="login"> Hasło:<input type="password" name="haslo"> Do kogo:<input type="text" name="do"> Wiadomoœć:<textarea name="tresc" rows="10" cols="40"></textarea><input type="submit" name="wyslij" value="Wyœlij"></form>'; } else { $a = new mbox(); $a->login($_POST['login'], $_POST['haslo']); $a->send($_POST['do'], $_POST['tresc']); } } catch (Exception $e) { echo $e->getMessage(); } ?> -------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 28.06.2025 - 00:30 |