Thursday 22 November 2018

How to save responose of cURL to XML file

Here Explain about how to save response of curl to xml file, follow the snippet of code
      $path = "http://www.abc.com";
      $user_agent="Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36";

 $in_curl = curl_init();
 curl_setopt($in_curl, CURLOPT_URL, $path);
 curl_setopt($in_curl, CURLOPT_POST, 0);
 curl_setopt($in_curl, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($in_curl, CURLOPT_HEADER, false);
 curl_setopt($in_curl, CURLOPT_USERAGENT,$user_agent);
 curl_setopt($in_curl, CURLOPT_CONNECTTIMEOUT , 30);
 curl_setopt($in_curl, CURLOPT_TIMEOUT, 5);
 curl_setopt($in_curl, CURLOPT_SSL_VERIFYPEER, false);# required for https urls
 
 $resultxml = curl_exec($in_curl);
 $status = curl_getinfo($in_curl);
 
 curl_close($session);

 if (file_put_contents ('./responsedata.xml', $resultxml) !== false) {
      echo 'Success!';
 } else {
      echo 'Failed';
 }

Friday 23 March 2018

Send Push Notification to Users Using Firebase Messaging Service in PHP

Send Push Notification to Users Browser Using Firebase Messaging Service in PHP   To Day I am Explain about how to send Push notifications using Firebase Cloud Messaging (FCM) in web application FCM service is free of charge with some limitations. The size is limited to 2KB or 4KB depending on the type of data, and the message will be kept for default duration of 4 weeks before it gets deleted.
Browser Support:
Chrome: 50+
Firefox: 44+
Opera Mobile: 37+