$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' => $message['title'],'push_message' => $message['message'],'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; } } ?>