![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 23.03.2009 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
to mój pierwszy post, dzień dobry. Mam problem z zapytaniem POST. Chcę wysłać wiadomość MMS przez bramkę intellisoftware. Pod tym (http://www.intellisoftware.co.uk/sms-gateway/http-interface/send-mms/) linkiem jest dostępny opis formatu MMSa. Przepiszę go tu dla leniwych: CODE Content-Type: multipart/form-data; boundary=AaB03x --AaB03x Content-Disposition: form-data; name="username" Content-Type: text/plain YourUsername --AaB03x Content-Disposition: form-data; name="password" Content-Type: text/plain YourPassword --AaB03x Content-Disposition: form-data; name="to" Content-Type: text/plain 0771012345 --AaB03x Content-Disposition: form-data; name="from" Content-Type: text/plain 0771054321 --AaB03x Content-Disposition: form-data; name="type" Content-Type: text/plain 5 --AaB03x Content-Disposition: form-data; name="text" Content-Type: text/plain MMS Message Subject --AaB03x Content-Disposition: form-data; filename="file1.txt" Content-Type: text/plain ... contents of file1.txt ... --AaB03x Content-Disposition: form-data; filename="file2.gif" Content-Type: image/gif Content-Transfer-Encoding: binary ...contents of file2.gif... --AaB03x-- To jest zendowski dump mojego zapytania: CODE ["zapytanie"] => array(1) { ["http"] => array(3) { ["method"] => string(4) "POST" ["header"] => string(52) "Content-Type: multipart/form-data; boundary=AaB03x " ["content"] => string(5471) "--AaB03x Content-Disposition: form-data; name="username" Content-Type: text/plain intelli_login --AaB03x Content-Disposition: form-data; name="password" Content-Type: text/plain intelli_password --AaB03x Content-Disposition: form-data; name="to" Content-Type: text/plain 48608288403 --AaB03x Content-Disposition: form-data; name="from" Content-Type: text/plain maciek --AaB03x Content-Disposition: form-data; name="type" Content-Type: text/plain 5 --AaB03x Content-Disposition: form-data; name="text" Content-Type: text/plain tematMMs --AaB03x Content-Disposition: form-data; filename="file1.txt" Content-Type: text/plain treasav adfaf aefafae faefaefaefa tttt --AaB03x Content-Disposition: form-data; filename="file2.gif" Content-Type: image/gif Content-Transfer-Encoding: binary GIF89(...); --AaB03x--" Wyciąłem zawartość Gifa, żeby nie zaśmiecać tego tematu jeszcze bardziej. Odpowiedź serwera to stale "request invalid". Hasło i login mam ok (jak zmienie, to krzyczy, że "login invalid"). Wydaje mi się, że zapytanie też mniej więcej ok. Całe zapytanie wysyłam do severa w ten sposób: CODE $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-Type: multipart/form-data; boundary=AaB03x'."\r\n", 'content' => $content ) ); $context = stream_context_create($opts); $fp = fopen('http://www.intellisoftware.co.uk/smsgateway/default.aspx', 'rb', false, $context); $result = stream_get_contents($fp); gdzie $content to jest to, co jest w tym dumpie jedną rubrykę wyżej. Nie wysyłałem nigdy żadnego POSTa, więc nie mam pojęcia co może być nie tak. Za wszelkie próby pomocy z góry dziękuję! Ten post edytował carambas 23.03.2009, 12:35:26 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 23.03.2009 Ostrzeżenie: (0%) ![]() ![]() |
poszedłem za Twoją radą (dzięki za szybką podpowiedź)
Oto co przekazuję jako parametr do curl (dump z Zenda): CODE array(8) { ["from"] => string(4) "ktos" ["text"] => string(5) "adfaf" ["username"] => string(6) "intelli_login" ["password"] => string(6) "intelli_haslo" ["type"] => string(1) "5" ["to"] => string(11) "48501000000" ["plik1"] => string(32) "@./gifs/1237803240-zrobsobie.gif" ["plik2"] => string(17) "@./gifs/tresc_tmp" } text to tamat MMSa. W ".gifs/tresc_tmp" zapisuję treść główną MMS (intelli chce, żeby to było w pliku to robię w pliku, żeby curl mógł sobie z tym odpowiednio poradzić). Polecenia curl: CODE $ch = curl_init('http://www.intellisoftware.co.uk/smsgateway/default.aspx'); //curl_setopt($ch, CURLOPT_CRLF, 1); // <- to jest zakomentowane curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); jak widać szablonowe, ściągnięte z sieci, niby sprawdzone. Ale nie działa. Dalej jest "request invalid". W dodatku jak odkomentuję linijkę, która powyżej jest zaznaczona // treść linijki // to dostaję błąd "ERR: NO PASSWORD", chociaż hasło jest podawane. Dodam, że nazwy elementów tablicy z dumpa powyżej odpowiadają nazwom pól, które są wymagane przez intelli. Ktoś może wie co robię źle? Próbowałem znaleźć sposób, żeby zobaczyć co wysyła curl, ale nie znalazłem takiej opcji. Pozdrawiam Ten post edytował carambas 23.03.2009, 11:20:15 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 27.09.2025 - 09:42 |