Comments (6)
It turns out that the problem was from the server ports and IP because there are specific ports that the firebase need to use to send notifications from.
Thank you for your help.
Here are the links that helped discover the problem:
https://firebase.google.com/docs/cloud-messaging/concept-options
https://support.fitnessondemand247.com/hc/en-us/articles/360007883114-Firewall-and-Network-Port-Rules
from php-fcm.
@mhd-yasser-haddad - you will need to post a bit more info. What is your config...what are your paths to the php-fcm project, etc? What is your script referencing? etc.
from php-fcm.
so I have this function inside a class that sends the notification:
//////////////////////////////
/////////////////////////////
public static function sendNotification($title, $body, $deviceToken, $data)
{
// Instantiate the client with the project api_token and sender_id.
$client = new \Fcm\FcmClient(SELF::$serverKey, SELF::$senderId);
// Instantiate the push notification request object.
$notification = new \Fcm\Push\Notification();
$notification
->addRecipient($deviceToken)
->setTitle($title)
->setBody($body);
foreach ($data as $key => $value)
$notification->addData($key, $value);
// Send the notification to the Firebase servers for further handling.
$response = $client->send($notification);
return $response;
}
//////////////////////////////
/////////////////////////////
I ran this code on my localhost and everything was going well, then I uploaded the code to the server and it stopped working and it kept giving me (500 internal server error).
Note that I tried to put echo and die statements in this code and everything was fine before the
"$response = $client->send($notification);"
and when I put it after this statement in got me an internal server error.
Thank you in advance
from php-fcm.
@mhd-yasser-haddad - Internal server error 500 typically means your code has errored out. Go to the folder with the script in it and check the error_log
to see if there is anything telling you whats wrong. If you don't see anything try a manual execution of the file from the command line and check error_log again. I suspect your paths to the FCM-PHP are not correct.
from php-fcm.
I tried to look for the error log file but I was unable to locate it, But I tried to use and call this function on the local server and everything ran okay, and I think that if the problem was from the directories the initialise of the $client and $notification variables wouldn't work out? don't you think?
from php-fcm.
unless you post actual technical stuff, not certain there is much anyone can do assist you.
from php-fcm.
Related Issues (20)
- Documentation not consistent with composer package HOT 8
- Increase automated test coverage to 100%
- Android Notification channel id HOT 11
- Guzzle option, made a bit of a mess of the commit / merge HOT 2
- Sending to multiple topics fails HOT 4
- Improve documentation
- If you add more than five topics in FCM, the push doesn't send
- Tag a new version for Guzzle 7 HOT 5
- Optional Laravel support HOT 3
- Priority settings missing? HOT 4
- Add TTL in Notification? HOT 1
- addTopic in && non only in || HOT 9
- If you send a data only push, and empty message is sent HOT 1
- Not Registered in Results => remove device_id HOT 3
- content_available field HOT 1
- Feature request: set time out value HOT 1
- Missing collapse key HOT 5
- Cloud Messaging API (Legacy) Deprecated HOT 2
- Tests not running as documented HOT 2
- Notification Received on mobile but not vibrating HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-fcm.