⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpi.inc.php

📁 这个是发送网站push的php程序
💻 PHP
📖 第 1 页 / 共 2 页
字号:
            return $message_id;        } else {            return false;        }    }    /* Function: public send_sl_message     * -------------------------------------------     * Purpose: send Service Loading message to specified address,     * Arguments: $address      - string,the address the push msg is sent to.     *                            could be: Device addresses as IP or MSISDN     *                                  or User-defined identifiers     *            $url          - string,the url is used to access the content     * Returns:  on error, return -1, on success ,return push id.     * Comments:     *          $address和$address_type必须一一对应。MSISDN--PLMN,IP--IPv4     * History:     */    function send_sl_message($address,$url,$sid="",$address_type="PLMN") {        //TODO    }    /* Function: private create_si_message     * -------------------------------------------     * Purpose: create a Service Indication type message     * Arguments: $url          - string,the url is used to access the content     *            $message      - string, the message displayed to the user     *            $sid          - string, identify the SIs     *            $created      - string, the time that content is created, NOT SI     *                              the format is YYYY-MM-DDThh:mm:ssZ     *            $expires      _ string, the time that specify when SI expires     * Returns: string, total SI message     * Comments:     * History:     */    function create_si_message($service_id,$url,$content,$message_id,$notify_to,$to,$from="") {        $sp_id = MPI_SP_ID;        $sp_passwd = MPI_SP_PASSWD;        $message_type = MPI_MSG_SI;        $sender_id = $from;        $receiver_id = $to;        $notify_request_to = $notify_to;        $deliver_before = $this->get_deliver_before();        $deliver_after = $this->get_deliver_after();        $si_expires = $this->get_si_expires();        $encoding = $this->get_content_encoding();        $msg = "<?xml version = \"1.0\" ?>" .            "<misc_command version=\"1.5\">" .                "<command_name>WPP_PS</command_name>" .                "<command_data_block>" .                    "<misc_data>" .                        "<sp_id>${sp_id}</sp_id>" .                        "<sp_password>${sp_passwd}</sp_password>" .                        "<service_id>${service_id}</service_id>" .                        "<sender_id>${sender_id}</sender_id>".                        "<charge_party>${charge_party}</charge_party>".                    "</misc_data>".                    "<pap_data>".                        "<message_id>$message_id</message_id>".                        "<message_type>$message_type</message_type>".                        "<deliver_before>$deliver_before</deliver_before>".                        "<deliver_after>$deliver_after</deliver_after>".                        "<notify_request_to>$notify_request_to</notify_request_to>".                        "<receiver_id>$receiver_id</receiver_id>".                    "</pap_data>".                    "<content_data>".                        "<href>$url</href>".                        "<si_expires>$si_expires</si_expires>".                        "<content>$content</content>".                        "<content_encoding>$encoding</content_encoding>".                    "</content_data>".                "</command_data_block>" .            "</misc_command>";        return $msg;    }    /* Function: private create_push_id     * -------------------------------------------     * Purpose: 根据流水号生成message_id     * Arguments: $id -   当天的流水号     * Returns: $message_id,格式yyyymmdd+$id(8位流水号)+@goodfeel.com.cn     * Comments:     * History:     */     function create_push_id($id) {        return ($this->_message_id = date("Ymd") . sprintf("%08d",$id) . "@goodfeel.com.cn");    }    /* Function: private get_push_id     * -------------------------------------------     * Purpose: generate the push id according to the current time and a random number     * Arguments:     * Returns: string,push id     * Comments: it will produce duplicated push id while this function is called     *              more than 100(or...) times per second.     * History:     */    function get_push_id() {        return $this->_message_id;    }    /* Function: private set_push_response     * -------------------------------------------     * Purpose: set push response to variables     * Arguments: $response -   push response from PPG gateway     * Returns: void     * Comments:     * History:     */     function set_push_response($response) {        $this->_push_response = $response;    }    /* Function: private get_push_response     * -------------------------------------------     * Purpose: get push response messages     * Arguments: $response -     * Returns: string, push respones message     * Comments:     * History:     */    function get_push_response() {        return $this->_push_response;    }    /* Function: private set_error     * -------------------------------------------     * Purpose: set error info to variables     * Arguments: $errno     -   error number     *            $errstr    -   error description     * Returns: void     * Comments: 相关函数get_last_error();     * History:     */    function set_error($errno,$errstr) {        $this->_errno = $errno;        $this->_errstr = $errstr;    }    /* Function: public get_last_error()     * -------------------------------------------     * Purpose: get the last error string     * Arguments:     * Returns: string, last error string     * Comments: 相关函数set_error();     * History:     */    function get_last_error() {        return $this->_errstr;    }    /* Function: private set_deliver_before     * -------------------------------------------     * Purpose: set deliver_before value     * Arguments: $deliver_before  - 14位字符串,格式YYYYMMDDHHMMSS     * Returns: void     * Comments: 相关函数get_deliver_before();     * History:     */    function set_deliver_before($deliver_before) {        $this->_deliver_before = $deliver_before;    }    /* Function: public get_deliver_before()     * -------------------------------------------     * Purpose: get the deliver before string     * Arguments:     * Returns: string, 14位字符串,格式YYYYMMDDHHMMSS     * Comments: 相关函数set_deliver_before();     * History:     */    function get_deliver_before() {        return $this->_deliver_before;    }    /* Function: private set_deliver_after     * -------------------------------------------     * Purpose: set deliver after value     * Arguments: $deliver_after  - 14位字符串,格式YYYYMMDDHHMMSS     * Returns: void     * Comments: 相关函数 get_deliver_after();     * History:     */    function set_deliver_after($deliver_after) {        $this->_deliver_after = $deliver_after;    }    /* Function: public get_deliver_after()     * -------------------------------------------     * Purpose: get the deliver after string     * Arguments:     * Returns: string, 14位字符串,格式YYYYMMDDHHMMSS     * Comments: 相关函数 set_deliver_after();     * History:     */    function get_deliver_after() {        return $this->_deliver_after;    }    /* Function: private set_si_expires     * -------------------------------------------     * Purpose: set si expires value     * Arguments: $si_expires  - 14位字符串,格式YYYYMMDDHHMMSS     * Returns: void     * Comments: 相关函数 get_si_expires();     * History:     */    function set_si_expires($si_expires) {        $this->_si_expires = $si_expires;    }    /* Function: public get_si_expires()     * -------------------------------------------     * Purpose: get the si_expries string     * Arguments:     * Returns: string, 14位字符串,格式YYYYMMDDHHMMSS     * Comments: 相关函数 set_si_expires();     * History:     */    function get_si_expires() {        return $this->_si_expires;    }    /* Function: private utf_encoding     * -------------------------------------------     * Purpose: set encoding to UTF8     * Arguments: void     * Returns: void     * Comments: 相关函数 get_content_encoding(),gb_encoding;     * History:     */    function utf_encoding() {        $this->_content_encoding = MPI_ENC_UTF8;    }    /* Function: private gb_encoding     * -------------------------------------------     * Purpose: set encoding to gb2312     * Arguments: void     * Returns: void     * Comments: 相关函数 get_content_encoding(),utf_encoding,ascii_encoding;     * History:     */    function gb_encoding() {        $this->_content_encoding = MPI_ENC_GB2312;    }    /* Function: private ascii_encoding     * -------------------------------------------     * Purpose: set encoding to ASCII     * Arguments: void     * Returns: void     * Comments: 相关函数 get_content_encoding(),utf_encoding,gb_encoding,ascii_encoding;     * History:     */    function ascii_encoding() {        $this->_content_encoding = MPI_ENC_ASCII;    }    /* Function: public get_content_encoding()     * -------------------------------------------     * Purpose: get the content_encoding string     * Arguments:     * Returns: int, 1代表UTF8,2代GB2312,3代表ASCII     * Comments: 相关函数 utf_encoding(),gb_encoding,ascii_encoding;     * History:     */    function get_content_encoding() {        return $this->_content_encoding;    }}//end Class definition?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -