tp 極光推送

2021-08-01 15:26:55 字數 2198 閱讀 2120

1. 推送類

[php]view plain

copy

[php]view plain

copy

<?php  

class

jpush  

/*  $receiver 接收者的資訊

tag(20個)array標籤組(並集): tag=>array('昆明','北京','曲靖','上海');

tag_and(20個)array標籤組(交集): tag_and=>array('廣州','女');

alias(1000)array別名(並集): alias=>array('93d78b73611d886a74*****88497f501','606d05090896228f66ae10d1*****310');

registration_id(1000)註冊id裝置標識(並集): registration_id=>array('20effc071de0b45c1a**********2824746e1ff2001bd80308a467d800bed39e');

$content 推送的內容。

$extras  附加字段  array型別

$m_time 儲存離線時間的秒數預設為一天(可不傳)單位為秒

*/public

function

push(

$receiver

='all'

, $title=''

, $content=''

, $extras

, $m_time

='86400'

)else

}  //推送的curl方法

public

function

push_curl(

$param=""

,$header=""

)   

$posturl

= $this

->url;  

$curlpost

= $param

;  $ch

= curl_init();                                      

//初始化curl

curl_setopt($ch

, curlopt_url,

$posturl

);                 

//抓取指定網頁

curl_setopt($ch

, curlopt_header, 0);                    

//設定header

curl_setopt($ch

, curlopt_returntransfer, 1);            

//要求結果為字串且輸出到螢幕上

curl_setopt($ch

, curlopt_post, 1);                      

//post提交方式

// 增加 http header(頭)裡的字段 

curl_setopt($ch

, curlopt_ssl_verifypeer, false);        

// 終止從服務端進行驗證

curl_setopt($ch

, curlopt_ssl_verifyhost, false);  

$data

= curl_exec(

$ch);                                 

//執行curl

curl_close($ch

);  

return

$data

;  }  

}  ?>  

2.執行推送的方法

[php]view plain

copy

public

function

pushmess()else

}else

}  

極光推送與極光IM

最近接了極光的推送和im,贊一下極光,他們的客服挺好的。極光推送會幫我們在後台推送和聊天,我們只需要按照他們文件呼叫他們的api。推送可以推送所有人,按別名,按組名,按極光regid來推送。所有人推送 catch apiconnectionexception e catch apirequestex...

極光推送Jpush

這幾天研究極光推送,發現挺好玩的 乙個jpush極光推送遠端呼叫api簡單的例項,php伺服器,貼上 文件參考 send.php include jpush.php n title 極光推送title n content 極光推送message mastersecret xx sendno 1234...

ios極光推送

ios 極光推送整合 分類 ios開發筆記 2014 11 20 13 49 2324人閱讀收藏 舉報jpush 極光推送 jpushdemo 極光推送整合 jpush整合 稍稍研究了一下極光推送,其實是非常簡單的,不過這個過程也出現了一些問題。對於應用在前台時,需要額外處理一下。關於極光推送,由於...