Aurora Push PHP SDK

Source: Internet
Author: User

<?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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.