2 Star 6 Fork 4

华为移动服务 / hms-push-serverdemo-php

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

HMS Pushkit PHP Severdemo

English | 中文

Table of Contents

Introduction

PHP sample code encapsulates APIs of the HUAWEI Push Kit server.It provides many sample PHP programs about quick access to HUAWEI Push Kit for your reference or usage.
The following table describes packages of PHP sample code.

Package Description
examples Sample code files. Each PHP file can run independently.
push_admin Package where APIs of the HUAWEI Push Kit server are
encapsulated.

Installation

Before using PHP sample code, check whether the PHP environment has been installed.

Supported Environments

The PHP sample code is debugged based on the XAMPP (MySQL + PHP + PERL) 5.6.26 development suite.

Configuration

The following table describes parameters of the __construct method.

Parameter Description
appid App ID, which is obtained from app information.
appsecret Secret access key of an app, which is obtained from app information.
access_token URL for the Huawei OAuth 2.0 service to obtain a token,
please refer to Generating an App-Level Access Token.
hw_token_server URL for accessing HUAWEI Push Kit, please refer to Sending Messages.

Sample Code

Download PHP sample code in Downloading Server Sample Code.
PHP sample code uses the Application structure in the push_admin package as the entry.
Core methods in the Application structure are used to call APIs of the HUAWEI Push Kit server.
The following table lists methods in Application.

Method Description
push_send_msg Sends a message to a device.
common_send_msg Subscribes to a topic, unsubscribes from a topic,
and queries the list of topics subscribed by a device.
__construc Constructor, which obtains key data for sending a message.

1.Send an Android data message.
Code location: examples/test_sample_push_passthrouth_msg.php

2.Send an Android notification message.
Code location: examples/test_sample_push_notification_msg.php

3.Send a message by topic.
Code location: examples/test_sample_push_topic_msg.php

4.Send a message by conditions.
Code location: examples/test_sample_push_condition_msg.php

5.Send a message to a Huawei quick app.
Code location: examples/test_sample_push_instantce_app_msg.php

6.Send a message through the WebPush agent.
Code location: examples/test_sample_push_webpush_msg.php

7.Send a message through the APNs agent.
Code location: examples/test_sample_apns_msg.php

8.Send a test message.
Code location: examples/test_sample_test_push_msg.php

Question or issues

If you want to evaluate more about HMS Core, r/HMSCore on Reddit is for you to keep up with latest news about HMS Core, and to exchange insights with other developers.

If you have questions about how to use HMS samples, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with huawei-mobile-services.
  • Huawei Developer Forum HMS Core Module is great for general questions, or seeking recommendations and opinions.

If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.

License

Pushkit PHP sample is licensed under the Apache License, version 2.0.

Comments ( 1 )

Sign in for post a comment

About

华为推送服务服务端PHP示例代码,对华为推送的服务端接口进行封装,包含丰富的示例程序,方便您参考或直接使用。 expand collapse
PHP
Apache-2.0
Cancel

Releases

No release

hms-push-serverdemo-php

Contributors

All

Activities

load more
can not load any more
PHP
1
https://gitee.com/hms-core/hms-push-serverdemo-php.git
git@gitee.com:hms-core/hms-push-serverdemo-php.git
hms-core
hms-push-serverdemo-php
hms-push-serverdemo-php
master

Search

105716 1d94204e 1850385 105716 2d26be5c 1850385