Sending notificaton from php

0 votes
I cant seem to get the api to actually send a notification the page displays this when i try

"Message is :helowExpiry is :2014-06-17T13:33:43.482ZUserName is :sammy********@gmail.com"  email ive hidden for privacy.

Is there an issue using the php api?

 

Thanks
asked Jun 17, 2014 in App42 Cloud API-BaaS by tigger2014 (10 points)

1 Answer

0 votes
Hi ,

There is nothing as issue by using php api to send a push notification.

Kindly let me know which type of error you are facing or share some more details like which SDK version you are working on & logs of that api.

Thanks.
answered Jun 17, 2014 by hs00105 (517 points)
im using version 2.1.1
This is my php code
<?php
include_once './2.1.1/PushNotificationService.php';
include_once './2.1.1/DeviceType.php';
include_once './2.1.1/App42Log.php';
include_once './2.1.1/App42Exception.php';
include_once './2.1.1/App42NotFoundException.php';
include_once './2.1.1/App42BadParameterException.php';
include_once './2.1.1/App42NotFoundException.php';
include_once './2.1.1/StorageService.php';
include_once './2.1.1/QueryBuilder.php';
include_once './2.1.1/Query.php';

App42API::initialize("REMOVED FOR SECURITY");
App42l

$pushNotificationService = App42API::buildPushNotificationService();
$pushNotification = $pushNotificationService->sendPushMessageToUser("sammy**********2@gmail.com","helow");   
print_r("Message is :".$pushNotification->getMessage());  
print_r("Expiry is :".$pushNotification->getExpiry());  
print_r("UserName is :".$pushNotification->getUserName());  
$jsonResponse = $pushNotification->toString();        
?>


How do i enable logging for this and where will i find the log

The error im facing is i never get the notifications
Thanks for writing.
1. Have you registered the device for which you are sending the message.
2. You can get your logs in Push Logs under Push Notification in AppHQ Management Console.
yup the device is registered and the messages come through if i send them from the management console, and the notifications sent from that script dont appear in the the log you mention
it seems that it works sometimes, but the notifications are delayed. Could someone look into this please.

thanks
We will check and update the thread if there is something wrong with this.

Thanks.
Thanks for the info
If you could also update this thread if there is no issues found that would be great too
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...