Created
October 14, 2014 22:24
-
-
Save almsx/2af662f9e2ee96bdd11e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*** SETUP ***************************************************/ | |
/*** Write by Ricardo Alcocer and Patrick Jongmans ***/ | |
$key = "WWJRXK3gzFfi2nAnNfwqUMCp6jq29Taf"; //GET FROM APP MANAGEMENT (ACS) | |
$username = "almsx";; | |
$password = "almsx"; | |
$channel = "ios"; | |
$message = "PRUEBA de iOS"; | |
$title = "PRUEBA DE ANDROID"; | |
$tmp_fname = 'cookie.txt'; | |
$json = '{"alert":"'. $message .'","title":"'. $title .'","vibrate":true,"sound":"default"}'; | |
/*** PUSH NOTIFICATION ***********************************/ | |
$post_array = array('login' => $username, 'password' => $password); | |
/*** INIT CURL *******************************************/ | |
$curlObj = curl_init(); | |
$c_opt = array(CURLOPT_URL => 'https://api.cloud.appcelerator.com/v1/users/login.json?key='.$key, | |
CURLOPT_COOKIEJAR => $tmp_fname, | |
CURLOPT_COOKIEFILE => $tmp_fname, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_POST => 1, | |
CURLOPT_POSTFIELDS => "login=".$username."&password=".$password, | |
CURLOPT_FOLLOWLOCATION => 1, | |
CURLOPT_TIMEOUT => 60); | |
/*** LOGIN **********************************************/ | |
curl_setopt_array($curlObj, $c_opt); | |
$session = curl_exec($curlObj); | |
/*** SEND PUSH ******************************************/ | |
$c_opt[CURLOPT_URL] = "https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=".$key; | |
$c_opt[CURLOPT_POSTFIELDS] = "channel=".$channel."&payload=".$json."&to_ids=everyone"; | |
curl_setopt_array($curlObj, $c_opt); | |
$session = curl_exec($curlObj); | |
/*** THE END ********************************************/ | |
curl_close($curlObj); | |
echo $session; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment