<?php
//php需要開啟ssl(OpenSSL)支持
$apnsCert = "ck
$pass = "
$serverUrl = "ssl://gateway
$deviceToken = "a
$message = $_GET [
$badge = ( int ) $_GET [
$sound = $_GET [
$body = array(
$streamContext = stream_context_create();
stream_context_set_option ( $streamContext
stream_context_set_option ( $streamContext
$apns = stream_socket_client ( $serverUrl
if ($apns) {
echo "Connection OK <br/>";
} else {
echo "Failed to connect $errorString";
return;
}
$payload = json_encode ( $body );
$msg = chr(
$result = fwrite ( $apns
fclose ( $apns );
if ($result)
echo "Sending message successfully: "
else
echo
?>
From:http://tw.wingwit.com/Article/program/PHP/201311/20950.html