<?PHPdefined(' In_wz ') orExit(' No Direct script access allowed ');/** * Created by Phpstorm. * User: Busy, ah Li * DATE:2016/9/7 * time:14:34*/require_once' Jpushsdk/autoload.php ' ; UseJpush\client asJpush;classwuzhi_jpushsdk{ Public functionIospushbyid ($registration _id,$alert){ $app _key= ' 0ac1e4c4ca231bf1f4444401 '; $master _secret= ' 9e7f16b3eba0c3c694444425 '; //$registration _id = ' 1a0018970aa604e54f9 '; $client=NewJpush ($app _key,$master _secret); //Full push example, including specifying platform, specifying ALIAS,TAG, specifying IOS,ANDROID notification, specifying message, etc. $result=$client-push ()->setplatform (Array(' iOS ', ' Android ')) //->addalias (' alias1 ')//->addtag (Array (' Tag1 ', ' Tag2 '))->setnotificationalert (' Hi, Jpush ')) ->addregistrationid ($registration _id) //->addandroidnotification (' Hi, Android notification ', ' notification title ', 1, Array ("Key1" = "value1", "Key2 "= =" value2 "))->addiosnotification ("Hi, iOS notification", ' iOS Sound ', 1999,true, ' IOS category ',Array("Key1" = "value1", "key2" = "value2")) //->setmessage ("msg content", ' msg title ', ' type ', Array ("Key1" = "value1", "key2" = "value2"))->setoptions ( Time(), 3600,NULL,true) -Send (); Echo' result= '. Json_encode ($result) ; } Public functionAndroidpushbyid ($registration _id,$alert) { $app _key= ' 0ac1e4c4ca231bf1f4444401 '; $master _secret= ' 9e7f16b3eba0c3c44444425 '; //$registration _id = ' 1a0018970aa604e54f9 '; $client=NewJpush ($app _key,$master _secret); $push _payload=$client-push ()->setplatform (Array(' Android ')) //->addallaudience ()->addregistrationid ($registration _id) ->setnotificationalert ($alert) ; Try { $response=$push _payload-Send (); }Catch(\jpush\exceptions\apiconnectionexception$e) { //try something here Print $e; } Catch(\jpush\exceptions\apirequestexception$e) { //try something here Print $e; } Print_r($response); }}
Aurora Push PHP SDK