Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3628020
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:57:45+00:00 2026-05-18T23:57:45+00:00

i am working on a project in PHP which requires me to push an

  • 0

i am working on a project in PHP which requires me to push an alert notification on APNS server. I have used enhanced push notification format. but I am not receiving response as specified by the APNS docs. I am getting response in three digits usually 133, 132, 154, 138, etc. Which I concluded to be Status signs, eg. 133 is 1, 3, 3. but now I have also received 139. so I doubt that my interpretation of response is wrong. But I am not getting where it is wrong. And important thing is though I am receiving these responses Alert is getting pushed and I am receiving notification on my iPhone as well as on iPad.

My code is as follows:

$payload['aps'] = array('alert' => $message, 'badge' => 1, 'sound' => 'default');

$apnsHost = 'gateway.sandbox.push.apple.com'; 

$apnsPort = 2195; // default port

$apnsCert = 'apns-dev.pem'; // APNS crtificate.

$passPhrase = '';

$streamContext = stream_context_create();

stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);

stream_context_set_option($streamContext, 'ssl', 'passphrase', $passPhrase);

try{

$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 60, STREAM_CLIENT_CONNECT, $streamContext);

if (!$apns) {
    print "Failed to connect {$error} {$errorString}\n";
}
else {   
    // Sending the payload

    $apnsMessage = chr(0) . pack('n', 1) . pack('n', $nid) . pack('n', time() + 604800) . pack('n', 32) . pack('H*', str_replace(' ', '', $alert_device_token)) .  pack('n', strlen($payload)) . $payload;

    echo 'APNS Message: ' . $apnsMessage;

    $fwrite = fwrite($apns, $apnsMessage);

    echo 'APNS response: ' . $fwrite;

And when this get executed i got the following response printed on the browser:

APNS Message: ��=ŸÂ� òc6–U:õŸŠ ¸Þ ÷ćÚ0ßqšÊzÂífÕnZ�`{“aps”:{“alert”:”Your EUR\/USD SELL alert price has been reached!”,”badge”:1,”sound”:”default”}}APNS response: 139

Can anyone please tell me what does this 139 means here. am doing anything wrong here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:57:46+00:00Added an answer on May 18, 2026 at 11:57 pm

    The echoed “139” is the return value of fwrite(). It’s the number of bytes written by fwrite()

    See: PHP: fwrite

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MySQL and PHP for a project I am working. I have
I'm working on a project which needs to be Unicode aware. PHP provides bunch
I am currently working on this project which requires me to make a function
I'm working on a project in PHP using Netbeans IDE which is best for
In a PHP project I'm working on we need to create some DAL extensions
I'm a longtime Java programmer working on a PHP project, and I'm trying to
I'm working on a PHP CMS like project and I'm trying to find out
I'm currently working on project with Haskell, and have found myself some trouble. I'm
I am working a project that does not have a trunk / branches /
I am working on project in Linux which involves 1) Static Lib in C++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.