r-soy
Members-
Posts
11 -
Joined
-
Last visited
r-soy's Achievements
Newbie (1/5)
0
Reputation
-
Ok, Can explain to me step by step please thank you
-
Please can help me on this I can provide my team viewer details thanks
-
In fact , I made GCM serive in my app , but I think it has limit of sending notification up to 1000 Can I do something please help me
-
Hello I have 100000 users , I am alwyes send information, In fact this information don't reach to all users , I don't know why ? I will attach send php files . and please see what is wrong of this flie and which logic I can use . Note if I change 1000 number to 3000 no user receive also I don't know why ------------------------------------ <?php include('session.php'); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <?php header('Content-type: text/html; charset=utf-8'); //generic php function to send GCM push notification function sendPushNotificationToGCM($registatoin_ids, $message) { //Google cloud messaging GCM-API url $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' => $registatoin_ids, 'data' => $message, ); define("GOOGLE_API_KEY", "AIzaSyB2x2jNi94zypUX_bqfYkhyuhrTwK0IG2XJ8");//saeed //define("GOOGLE_API_KEY", "AIzaSyDYoI9libqfYkhyuhr-rxGW_G0TVDUe4dg");//amjad $headers = array( 'Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); //curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); $result = curl_exec($ch); if ($result === FALSE) { die('Curl failed: ' . curl_error($ch)); } curl_close($ch); return $result; } ?> <?php header('Content-type: text/html; charset=utf-8'); $response = array(); require_once __DIR__ . '/db_connect.php'; $db = new DB_CONNECT(); if (isset($_GET['level']) &&isset($_GET['m1']) &&isset($_GET['m2']) &&isset($_GET['m3']) &&isset($_GET['m4']) &&isset($_GET['m5']) &&isset($_GET['m6']) &&isset($_GET['m7'])){ $level=$_GET['level']; $m1=$_GET['m1']; $m2=$_GET['m2']; $m3=$_GET['m3']; $m4=$_GET['m4']; $m5=$_GET['m5']; $m6=$_GET['m6']; $m7=$_GET['m7']; $m11=mysql_real_escape_string($_GET['m1']); $m21=mysql_real_escape_string($_GET['m2']); $m31=mysql_real_escape_string($_GET['m3']); $m41=mysql_real_escape_string($_GET['m4']); $m51=mysql_real_escape_string($_GET['m5']); $m61=mysql_real_escape_string($_GET['m6']); $m71=mysql_real_escape_string($_GET['m7']); mysql_query("SET NAMES 'utf8'"); $resultaa = mysql_query("INSERT words (id, level, m1, m2, m3, m4, m5, m6, m7) VALUES (NULL,'$level','$m11','$m21','$m31','$m41','$m51','$m61','$m71')"); $id = mysql_insert_id(); if($level == 0){ $result = mysql_query("SELECT Rid FROM users "); }else{ $result = mysql_query("SELECT Rid FROM users where level = '$level' OR level = '4'"); //$result = mysql_query("SELECT Rid FROM users where level = '$level'"); } $message = array( 'word_id' => $id, 'm1' => $m1, 'm2' => $m2, 'm3' => $m3, 'm4' => $m4, 'm5' => $m5, 'm6' => $m6, 'm7' => $m7, 'level' => $level ); if (mysql_num_rows($result) > 0) { for($counter = 0; $counter<mysql_num_rows($result) ; $counter+=1000){ $gcmRegIds=array(); for($counter2=$counter ; $counter2<$counter+1000;$counter2++){ if($counter2<mysql_num_rows($result)){ $row = mysql_fetch_array($result); $gcmRegIds[]=$row["Rid"]; } } $pushStatus = sendPushNotificationToGCM($gcmRegIds, $message); echo $pushStatus; } $time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]; echo "Process Time: {$time}"; }else { $response["success"] = 0; $response["message"] = "No user found"; echo json_encode($response); } //echo $result; } else { // required field is missing $response["success"] = 0; $response["message"] = "Required field(s) is missing"; // echoing JSON response echo json_encode($response); } ?> </body> </html>
-
I didn't got it please can expaline more
-
I have a sending page, it php page. this page I used to send text to users in database In fact, In my database I have 27969 users when I send a text only go for 17106 only where reaming users why this php page didn't sent to all 27969 please help me ---------------------- this my code : <?php include('session.php'); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <?php header('Content-type: text/html; charset=utf-8'); //generic php function to send GCM push notification function sendPushNotificationToGCM($registatoin_ids, $message) { //Google cloud messaging GCM-API url $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' => $registatoin_ids, 'data' => $message, ); define("GOOGLE_API_KEY", "AIzaSyB3x8jNi11zyqUX_ShdRC65TwK1IG2XJ1");//saeed $headers = array( 'Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); //curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); $result = curl_exec($ch); if ($result === FALSE) { die('Curl failed: ' . curl_error($ch)); } curl_close($ch); return $result; } ?> <?php header('Content-type: text/html; charset=utf-8'); $response = array(); require_once __DIR__ . '/db_connect.php'; $db = new DB_CONNECT(); if (isset($_GET['level']) &&isset($_GET['m1']) &&isset($_GET['m2']) &&isset($_GET['m3']) &&isset($_GET['m4']) &&isset($_GET['m5']) &&isset($_GET['m6']) &&isset($_GET['m7'])){ $level=$_GET['level']; $m1=$_GET['m1']; $m2=$_GET['m2']; $m3=$_GET['m3']; $m4=$_GET['m4']; $m5=$_GET['m5']; $m6=$_GET['m6']; $m7=$_GET['m7']; $m11=mysql_real_escape_string($_GET['m1']); $m21=mysql_real_escape_string($_GET['m2']); $m31=mysql_real_escape_string($_GET['m3']); $m41=mysql_real_escape_string($_GET['m4']); $m51=mysql_real_escape_string($_GET['m5']); $m61=mysql_real_escape_string($_GET['m6']); $m71=mysql_real_escape_string($_GET['m7']); mysql_query("SET NAMES 'utf8'"); $resultaa = mysql_query("INSERT words (id, level, m1, m2, m3, m4, m5, m6, m7) VALUES (NULL,'$level','$m11','$m21','$m31','$m41','$m51','$m61','$m71')"); $id = mysql_insert_id(); if($level == 0){ $result = mysql_query("SELECT Rid FROM users "); }else{ $result = mysql_query("SELECT Rid FROM users where level = '$level' OR level = '4'"); //$result = mysql_query("SELECT Rid FROM users where level = '$level'"); } $message = array( 'word_id' => $id, 'm1' => $m1, 'm2' => $m2, 'm3' => $m3, 'm4' => $m4, 'm5' => $m5, 'm6' => $m6, 'm7' => $m7, 'level' => $level ); if (mysql_num_rows($result) > 0) { for($counter = 0; $counter<mysql_num_rows($result) ; $counter+=1000){ $gcmRegIds=array(); for($counter2=$counter ; $counter2<$counter+1000;$counter2++){ if($counter2<mysql_num_rows($result)){ $row = mysql_fetch_array($result); $gcmRegIds[]=$row["Rid"]; } } $pushStatus = sendPushNotificationToGCM($gcmRegIds, $message); echo $pushStatus; } $time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]; echo "Process Time: {$time}"; }else { $response["success"] = 0; $response["message"] = "No user found"; echo json_encode($response); } //echo $result; } else { // required field is missing $response["success"] = 0; $response["message"] = "Required field(s) is missing"; // echoing JSON response echo json_encode($response); } ?> </body> </html>
-
How I can explain that !!! For example : You have 4 members you want everyday send to them a text such ( hello ! ) without enter your website some job ruining all the time . Another example : You have Button in your page, and if you click that Button will send a text to users, but I don't want to click that Button I want each 24 hours that text sending to users no need to click the Button in another words ( I have quiz page and every day I send the questions of that day by clicking a button but actually I want this task to be done automatically by the page itself )