Dołączone pliki | plus.nut.diff [^] (3,858 bajtów) 2016-04-30 22:53 [Pokaż zawartość] [Ukryj zawartość]--- plus.nut Fri Oct 09 02:55:18 2015
+++ plus.nut Sat Apr 30 22:49:05 2016
@@ -20,23 +20,69 @@
return 2;
}
- local postData = format("7|0|12|https://www1.plus.pl/bsm/|39818686DE7694002AE060E228146942|pl.plus.map.bsm.gwt.client.service.SendSmsService|send|pl.plus.map.bsm.core.gwt.dto.MessageTO/1868309509|%s|%s|02661acfecfb6fa9651458edc87eee46|%s||%s|%s|1|2|3|4|1|5|5|0|0|6|7|8|0|0|9|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|10|11|0|0|0|12|0|0|10|0|0|0|0|", urlEncode(tokenValue), tokenID, msg, to, sign);
+ local function replace(str, find, repl)
+ {
+ local ret = "";
+ while(true)
+ {
+ local found = str.find(find);
+ if(found == null) break;
+ ret += str.slice(0, found) + repl;
+ str = str.slice(found + find.len());
+ }
+ ret += str;
+ return ret;
+ }
+
+ local function escapeJSON(str)
+ {
+ str = replace(str, "\\", "\\\\");
+ str = replace(str, "\"", "\\\"");
+ str = replace(str, "\f", "\\f");
+ str = replace(str, "\n", "\\n");
+ str = replace(str, "\r", "\\r");
+ str = replace(str, "\t", "\\t");
+ return str;
+ }
+
+ local postData = "{" +
+ "\"receivers\":\"" + escapeJSON(to) + "\"," +
+ "\"sender\":\"" + escapeJSON(sign) + "\"," +
+ "\"content\":\"" + escapeJSON(msg) + "\"," +
+ "\"captchaId\":\"" + escapeJSON(tokenID) + "\"," +
+ "\"captchaAnswer\":\"" + escapeJSON(tokenValue) + "\"," +
+ "\"captchaIdSMedia\":null," +
+ "\"captchaAnswerSMedia\":\"\"," +
+ "\"freeGate\":true," +
+ "\"answerMessage\":false," +
+ "\"saveInOutbox\":false," +
+ "\"flashMessage\":false," +
+ "\"sendLater\":false," +
+ "\"sendDate\":null," +
+ "\"draftMessageId\":null," +
+ "\"draft\":false," +
+ "\"mms\":false," +
+ "\"type\":\"S\"," +
+ "\"vCard\":false," +
+ "\"idFolder\":2," +
+ "\"smediaValid\":false" +
+ "}";
local hNet = httpCreate();
- local retVal = 2;
+ local retVal = 0;
if(hNet != null && httpOpen(hNet))
{
- local headers = format("Content-Type: text/x-gwt-rpc; charset=utf-8\r\nX-GWT-Module-Base: https://www1.plus.pl/bsm/\r\nX-GWT-Permutation: 22E4064F5698D299DC724EC04F1478DC\r\nReferer: https://www1.plus.pl/bsm/\r\nContent-Length: %d\r\n", postData.len());
+ local headers = format("Content-Type: application/json;charset=utf-8\r\nAccept: application/json, text/plain, */*\r\nContent-Length: %d\r\n", postData.len());
if(httpSetHeaders(hNet, headers))
{
- if(httpGetFile(hNet, "https://www1.plus.pl/bsm/service/SendSmsService", "POST", postData, true))
+ if(httpGetFile(hNet, "https://www1.plus.pl/bsm/service/SendSmsService/send", "POST", postData, true))
{
local data = httpGetFileData(hNet);
- retVal = 0;
+ retVal = 2;
- if(data.find("//OK[") != null)
+ if(data.find("\"statusCode\" : 200") != null)
{
log(hLog, "Wiadomość wysłana");
retVal = 1;
@@ -45,7 +91,27 @@
{
log(hLog, "Błędny token");
}
- else if(data.find("//EX[") != null)
+ else if(data.find("MaxSmsFromOneIPException") != null)
+ {
+ log(hLog, "Przekroczono dozwoloną liczbę wysłanych SMS-ów");
+ }
+ else if(data.find("MaxSmsOneContentException") != null)
+ {
+ log(hLog, "Przekroczono dozwoloną liczbę wysłanych SMS-ów o takiej samej treści");
+ }
+ else if(data.find("MaxSmsToOneReceiverException") != null)
+ {
+ log(hLog, "Przekroczono dozwoloną liczbę wysłanych SMS-ów do tego samego odbiorcy");
+ }
+ else if(data.find("ForbiddenSmsContentException") != null)
+ {
+ log(hLog, "Treść SMS-a zawiera niedozwolone słowa");
+ }
+ else if(data.find("InvalidReceiverException") != null)
+ {
+ log(hLog, "Błędny odbiorca");
+ }
+ else if(data.find("Exception") != null)
{
log(hLog, "Nieznany błąd bramki");
}
|