Skip to content

Instantly share code, notes, and snippets.

View hungdh9x's full-sized avatar
:octocat:
Not Found

Huy Hùng hungdh9x

:octocat:
Not Found
View GitHub Profile
@hungdh9x
hungdh9x / GCM.php
Last active March 16, 2016 09:43
GCM with Android
<?php
public function send_notification($registration_ids, $message) {
include_once './config.php';
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => $registration_ids,
'data' => $message,
);
$headers = array(
@hungdh9x
hungdh9x / db_functions.php
Created January 14, 2016 17:18
GCM with Android Tutorial
<?php
class DB_Functions {
private $db;
//put your code here
// constructor
function __construct() {
include_once './db_connect.php';
@hungdh9x
hungdh9x / db_connect.php
Last active March 16, 2016 09:41
GCM with Android Tutorial
<?php
public function connect() {
require_once 'config.php';
$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
// selecting database
mysql_select_db(DB_DATABASE);
// return database handler
return $con;
}
// Closing database connection
<?php
// Database config variables
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASSWORD", "123456");
define("DB_DATABASE", "gcm");
// Google API Key
define("GOOGLE_API_KEY", "AIzaSyA7***************ViqJE");
?>