PHP homing Pigeon push (for token push)

Source: Internet
Author: User
title//push title, content//push content account//corresponding User token $type//Custom parameter

First go to the carrier Pigeon official website to apply for key, and then access key and reference xingeapp.php (available on the official website) because the following methods are based on the development of Xingeapp

protected function Pushaccoun ($title, $content, $account, $type) {

$pushAndroid = new Xingeapp (88888, ' 888888 ');
$pushIOS = new Xingeapp (888888, ' 888888);
$mess = new Message ();
$mess->settype (message::type_notification);
$mess->settitle ($title);
$mess->setcontent ($content);
$mess->setexpiretime (0);
$style = new Style (0);
#含义: Style number 0, ring, vibrate, not clear from the notification bar, does not affect the previous notification
$style = new Style (0, 1, 1, 1, 0);
$action = new ClickAction ();
$action->setactiontype (clickaction::type_activity);
#打开url需要用户确认
$action->setcomfirmonurl (0);
$mess->setstyle ($style);
$mess->setaction ($action);
$mess->setcustom (Array (' id ' = ' ", ' title ' = '" ' "', ' type ' = ' = $type)");
$messios = new Messageios ();
$messios->setexpiretime (0);
$messios->setalert ($content);
$messios->setbadge (1);
$messios->setsound ("");
$messios->setcustom (' id ' = ' + ', ' title ' = ' "', ' content ' = ' $content, ' type ' + $type));
$acceptTime 1 = new TimeInterval (0, 0, 23, 59);
$mess->addaccepttime ($acceptTime 1);
$ret = $pushAndroid->pushsingleaccount (0, $account, $mess);
$ret 1 = $pushIOS->pushsingleaccount (0, $account, $messios, Xingeapp::iosenv_dev);
$ret = Array ($ret, $ret 1);
return $ret;
}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the PHP homing pigeon push (for token push), including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.