'PushNotifications send to android.', 'title' => 'PushNotifications title to android.', 'subtitle' => 'PushNotifications subtitle to android.', 'tickerText'=> 'PushNotifications Ticker text here...', 'vibrate' => 1, 'sound' => 1, 'largeIcon' => 'large_icon', 'smallIcon' => 'small_icon' ); } else { $message = array ( 'message' => $message_text, 'title' => $msg_title, 'vibrate' => 1, 'sound' => 1, 'largeIcon' => 'large_icon', 'smallIcon' => 'small_icon' ); } $fields = array( 'registration_ids' => $registatoin_ids, 'data' => $message, ); $headers = array( 'Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Disabling SSL Certificate support temporarly curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); // Execute post $result = curl_exec($ch); if ($result === FALSE) { die('Curl failed: ' . curl_error($ch)); } //echo $result; //check the result global $wpdb; $blogtime = current_time( 'mysql' ); $all_pushnotification_logs = $wpdb->prefix . 'all_pushnotification_logs'; foreach ( $registatoin_ids as $registatoin_id ) { $wpdb->insert($all_pushnotification_logs,array('push_title' => $msg_title,'push_message' => $message_text,'push_sent' => 1,'push_send_date' => $blogtime,'devicetoken_id' =>$registatoin_id),array('%s','%s','%d','%s','%s')); //$wpdb->print_error(); } // Close connection curl_close($ch); return $error; } } ?>