API שליחת סמסים בחברת מיקרופיי
-
זה לכאורה גם בget
<?php //******************************************************************************* // Function: mpSendSMS // Author: MicroPay // Parameters: // Required: // token - the token you created in MicroPay // msg - the message yo want to send // to - comma seperated phone list or pool id in micropay system // from - phone number that will appear as source of the SMS // Optional: // date - date for scheduling in the format "2009-08-17 14:33" -> YYYY-MM-DD HH:MM // Return: // result of the request //******************************************************************************* function mpSendSMS($token, $msg, $to, $from, $date = "") { $msg = urlencode($msg); $request = "http://www.micropay.co.il/ExtApi/ScheduleSms.php"; $request .= "?get=1&token=".$token."&msg=".$msg."&from=".$from; if (strlen($to) > 8) $request .= "&list=".$to; else $request .= "&pid=".$to; if ($date != "") { $DateValue = strtotime($date); $DateParts = getdate($DateValue); $request .= "&dy=".$DateParts["year"]; $request .= "&dm=".$DateParts["mon"]; $request .= "&dd=".$DateParts["mday"]; $request .= "&dh=".$DateParts["hours"]; $request .= "&di=".$DateParts["minutes"]; } $curlSend = curl_init(); curl_setopt($curlSend, CURLOPT_URL, $request); curl_setopt($curlSend, CURLOPT_RETURNTRANSFER, 1); $curlResult = curl_exec($curlSend); $curlStatus = curl_getinfo($curlSend, CURLINFO_HTTP_CODE); curl_close($curlSend); if ($curlStatus === 200) return $curlResult; else return "ERROR"; } ?> -
זה לכאורה גם בget
<?php //******************************************************************************* // Function: mpSendSMS // Author: MicroPay // Parameters: // Required: // token - the token you created in MicroPay // msg - the message yo want to send // to - comma seperated phone list or pool id in micropay system // from - phone number that will appear as source of the SMS // Optional: // date - date for scheduling in the format "2009-08-17 14:33" -> YYYY-MM-DD HH:MM // Return: // result of the request //******************************************************************************* function mpSendSMS($token, $msg, $to, $from, $date = "") { $msg = urlencode($msg); $request = "http://www.micropay.co.il/ExtApi/ScheduleSms.php"; $request .= "?get=1&token=".$token."&msg=".$msg."&from=".$from; if (strlen($to) > 8) $request .= "&list=".$to; else $request .= "&pid=".$to; if ($date != "") { $DateValue = strtotime($date); $DateParts = getdate($DateValue); $request .= "&dy=".$DateParts["year"]; $request .= "&dm=".$DateParts["mon"]; $request .= "&dd=".$DateParts["mday"]; $request .= "&dh=".$DateParts["hours"]; $request .= "&di=".$DateParts["minutes"]; } $curlSend = curl_init(); curl_setopt($curlSend, CURLOPT_URL, $request); curl_setopt($curlSend, CURLOPT_RETURNTRANSFER, 1); $curlResult = curl_exec($curlSend); $curlStatus = curl_getinfo($curlSend, CURLINFO_HTTP_CODE); curl_close($curlSend); if ($curlStatus === 200) return $curlResult; else return "ERROR"; } ?> -
עכשיו הם שלחו לי את זה.
לא הבנתי איפה הם רוצים שיכנס מספר הטלפון השולח המקבל.<script type="text/javascript"> <!-- // param - need to be someting like this: 'post=2&uid=#####&un=#####&msg=test+message&list=0545370070&from=03622222' function sendSms(param) { var xhr = new XMLHttpRequest(); xhr.open("POST", 'http://www.micropay.co.il/ExtApi/ScheduleSms.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xhr.send(param); xhr.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { alert(this.responseText); } }; } //--> </script> <a href -
אבל זה נראה שהם בונים איזה אובייקט?.. כלומר אני רואה שהם מפרקים את זה יותר לחלקים.
אגב מעניין שגם הם הוסיפו את מה שהוספת
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");אני שם את מה שהוא שלח XMLHttpRequest ייוצר לי שגיאה, וגם alert
אולי הספרייה של corvid לא תומכת בזה? -
אבל זה נראה שהם בונים איזה אובייקט?.. כלומר אני רואה שהם מפרקים את זה יותר לחלקים.
אגב מעניין שגם הם הוסיפו את מה שהוספת
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");אני שם את מה שהוא שלח XMLHttpRequest ייוצר לי שגיאה, וגם alert
אולי הספרייה של corvid לא תומכת בזה? -
סליחה, הם כן נתנו קוד של פוסט, טעיתי וקראתי את הקוד הקודם.
תשנה את הפרמטרים פה לרלוונטי ותדביק את זה בקונסול של הדפדפן:var xhr = new XMLHttpRequest(); xhr.open("POST", 'https://www.micropay.co.il/ExtApi/ScheduleSms.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xhr.send("post=2&uid=#####&un=#####&msg=test+message&list=0545370070&from=0362222"); xhr.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) alert(this.responseText); }מה כתוב לך?
-
@dovid אמר בAPI שליחת סמסים בחברת מיקרופיי:
XMLHttpRequest
אולי זה התחליף שלהם?
https://www.wix.com/corvid/reference/wix-http-functions/wixhttpfunctionrequest -
סליחה, הם כן נתנו קוד של פוסט, טעיתי וקראתי את הקוד הקודם.
תשנה את הפרמטרים פה לרלוונטי ותדביק את זה בקונסול של הדפדפן:var xhr = new XMLHttpRequest(); xhr.open("POST", 'https://www.micropay.co.il/ExtApi/ScheduleSms.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xhr.send("post=2&uid=#####&un=#####&msg=test+message&list=0545370070&from=0362222"); xhr.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) alert(this.responseText); }מה כתוב לך?
שלום! נראה שהשיחה הזו מעניינת אותך, אבל עדיין אין לך חשבון.
נמאס לכם לגלול בין אותם הפוסטים בכל ביקור? כשנרשמים לחשבון, תמיד תחזרו בדיוק למקום שבו הייתם קודם, ותוכלו לבחור לקבל התראות על תגובות חדשות (בין אם במייל, ובין אם בהתראת פוש). תוכלו גם לשמור סימניות ולפרגן ב-upvote לפוסטים כדי להביע הערכה לחברי קהילה אחרים.
בעזרת התרומה שלך, הפוסט הזה יכול להיות אפילו טוב יותר 💗
הרשמה התחברות