티스토리 뷰
<?php $token = "자신의기기토큰"; $apnsPort = 2195; // dev $apnsHost = 'gateway.sandbox.push.apple.com'; $apnsCert = 'apns-dev.pem'; // production //$apnsHost = 'gateway.push.apple.com'; //$apnsCert = 'apns-production.pem'; $streamContext = stream_context_create(); stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert); $apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext); if ($apns) { $payload['aps'] = array('alert' => 'Oh hai!', 'badge' => 1, 'sound' => 'default'); $output = json_encode($payload); $token = pack('H*', str_replace(' ', '', $token)); $apnsMessage = chr(0) . chr(0) . chr(32) . $token . chr(0) . chr(strlen($output)) . $output; fwrite($apns, $apnsMessage); fclose($apns); } ?>
'모바일 > iOS' 카테고리의 다른 글
XCode 4.x 이상에서 디버깅 셋팅과 추적 (0) | 2013.05.27 |
---|---|
APNS 푸시 서버 라이브러리 (0) | 2012.08.13 |
EasyAPNs 메세지 발송 소스 (0) | 2012.07.30 |
Easy APNs (PHP와 함께 iOS 푸시 알림 서비스 구축) (2) | 2012.07.17 |
iOS 아이폰 아이콘 크기 안내 (0) | 2012.05.07 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 한글
- sencha touch
- classic asp
- centos
- PHP
- nodejs
- IE
- JSON
- Wordpress
- laravel
- Linux
- Prototype
- nginx
- Android
- iphone
- JQuery
- git
- API
- mssql
- CSS
- Mac
- Debug
- 안드로이드
- IOS
- 워드프레스
- ASP
- javascript
- iis
- macos
- Docker
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
글 보관함