Skip to main content

Posts

Showing posts from May, 2019

Read and write json file with php and mysql

JavaScript Object Notation or  JSON  is a lightweight data-interchange format which is very easy to read and write, we use JSON to transfer data from server to web-application or vice versa as an alternative to XML. In this post I will be showing you how to read and write JSON file with php and mysql. What is json? How does it looks? JSON is nothing but a data format similar like arrays. It comes in key value pair e.g. {Name:Rahul, Age:22}. JSON is a human-readable text format that is completely language independent but uses conventions of programming language like C, C++, JavaScript. See how JSON data looks like. [ { "player_name" : "Sachin Tendulkar" , "country" : "India" , "sports" : "Cricket" } , { "player_name" : "Roger Federer" , "country" : "Switzerland" , "sports" :

Send Push notification using php(FCM)

Hello, Here is our new topic. Sending push notification using FCM FCM FCM is a new version of GCM (Google Cloud Messaging) service. It is a cross-platform messaging service, used to send notifications that are displayed to the user. We can use any of three ways to send messages to the client app - single devices, groups of devices or devices subscribed to topics. It also sends acknowledgments back to the server. We can use FCM for iOS clients, Android clients, Unity clients, web clients and more. FCM is reliable and battery-efficient. Just copy and paste the code and change the credentials to yours <?php $url = "https://fcm.googleapis.com/fcm/send" ; $token = "your device token" ; $serverKey = 'your server token of FCM project' ; $title = "Notification title" ; $body = "Hello I am from Your php server" ; $notification = array ( 'title' => $title , 'body' =