Build an apns push server using php

Source: Internet
Author: User
Follow the tutorial blog. csdn. netnewjueqiarticledetails7898591. Note: 1. the push address used in the test phase: ssl: gateway.sandbox.push.apple.com: 2195 the push address used for official launch: ssl: gateway.push.apple.com: 21952. The php push code from there is a question.

It is done by following the tutorial http://blog.csdn.net/newjueqi/article/details/7898591. Note: 1. push address used in the test phase: ssl: // gateway.sandbox.push.apple.com: 2195: ssl: // gateway.push.apple.com: 2195 2. the php push Code provided there is a question

It is done by following the tutorial http://blog.csdn.net/newjueqi/article/details/7898591.


Note:

1. Push address used in the test phase:

Ssl: /gateway.sandbox.push.apple.com: 2195


The push address officially launched:

Ssl: // gateway.push.apple.com: 2195


2.

If there is a problem with the php push code, I will post the code successfully pushed after the modification:


 $ Message, 'Forum _ id' => 88, 'topic _ id' => 999,); // Encode the payload as JSON $ payload = json_encode ($ body ); // Build the binary notification // $ msg = chr (0 ). pack ('n', 32 ). pack ('h', $ deviceToken ). pack ('n', strlen ($ payload )). $ payload; $ msg = chr (0 ). pack ("n", 32 ). pack ('H * ', str_replace ('','', $ deviceToken )). pack ("n", strlen ($ payload )). $ payload; // Send it to the server $ result = fwrite ($ fp, $ msg, st Rlen ($ msg); if (! $ Result) {echo 'message not delivered '. PHP_EOL;} else {echo 'message successfully delivered '. PHP_EOL;} // Close the connection to the serverfclose ($ fp);?>


[Author] Zeng jiansheng

[Author email] zengjiansheng1@126.com

[Author QQ] 190678908

[Blog] http://blog.csdn.net/newjueqi

Http://blog.sina.com.cn/h6k65

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.