Php fulfills the "push" function of "multiple" terminal devices
Source: Internet
Author: User
Php implements the "push" function of "multiple" terminal devices. how can I use the "push" function of "& nbsp; php code" to implement the push information function of devices such as "ios & nbsp? Many terminal devices may need to receive the push information, and execute a script to provide some useful suggestions for pushing multiple times. thank you for implementing the "push" function for "multiple" terminal devices "in php.
How can I use php code to implement the push information function of ios and other devices?
Many terminal devices may need to receive push information, and execute a script to push messages multiple times.
Some useful suggestions are provided by passing by. Thanks for pushing the PHP terminal to share the following:
------ Solution --------------------
Since you have read related articles, why are you still asking?
Here, we can only give you some ideas. the specific code should be written by yourself.
The principle is nothing more than establishing a connection (similar to a socket), sending bytes from the server to the device, and how the device can handle them after receiving the message-direct display, pop-up window, notification, and flashing reminder.
There are two methods
1. the server acts as the server, and various devices act as the client to establish persistent connections. the server sends messages based on the trigger conditions, which is a bit like a chat room.
2. reverse thinking: a variety of devices act as servers (not wrong, it is the server), log on to the server and write down its listening ip/port (login is not necessarily sent, the purpose is to submit the online status ), based on the trigger condition, the server also runs the client program to submit connection requests to all the logged-on devices. after the connection is successful, the server sends a connection request.
------ Solution --------------------
$ Fp = stream_socket_client ("ssl: // gateway.sandbox.push.apple.com: 2195", $ err, $ errstr, 60,
STREAM_CLIENT_CONNECT, $ ctx );
The key is this. The app needs to register with the apple server to receive notifications. After registration, PHP sends a message to the apple server, and the apple server completes the push.
Instead of pushing PHP directly to the app.
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.