"{$url}", CURLOPT_PORT => 443, CURLOPT_HTTPHEADER => $headers, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $message, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSLCERT => $cert, CURLOPT_HEADER => 1 )); // go... $result = curl_exec($http2ch); if ($result === FALSE) { throw new Exception('Curl failed with error: ' . curl_error($http2ch)); } // get respnse $status = curl_getinfo($http2ch, CURLINFO_HTTP_CODE); $duration = round(microtime(true) * 1000) - $milliseconds; // echo $duration; return $status; } // open connection if (!defined('CURL_HTTP_VERSION_2_0')) { define('CURL_HTTP_VERSION_2_0', 3); } $http2ch = curl_init(); curl_setopt($http2ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); // send push $apple_cert = '/certificates/samplepush/development.pem'; $message = '{"aps":{"alert":"Hi!","sound":"default"}}'; $token = 'dbdaeae86abcde56rtyww1859fb41d2c7b2cberrttyyy053ec48987847'; $http2_server = 'https://api.development.push.apple.com'; // or 'api.push.apple.com' if production $app_bundle_id = 'it.tabasoft.samplepush'; // close connection for ($i = 0; $i < 20; $i++) { $status = sendHTTP2Push($http2ch, $http2_server, $apple_cert, $app_bundle_id, $message, $token); echo "Response from apple -> {$status}\n"; } curl_close($http2ch);