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 the information multiple times, thanks 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.
Helpful suggestions for passing by. thank you.
PHP terminal push
Share:
------ 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, flashing reminder, etc.
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.