ios - Send Multiple Device Tokens to Parse through CURL -
i using parse send push notifications ios app users. works well, way have constructed leads page timeout when sending push many users.
the code below in while loop sends data 1 device token @ time through curl. how reconstruct payload can push single json array contain of device tokens etc... ideas?
my while loop:
$target_device = $row['device_token']; $push_payload = json_encode(array( "where" => array( "devicetoken" => $target_device, ), "data" => array( "alert" => "$message" ) )); $rest = curl_init(); curl_setopt($rest,curlopt_url,$url); curl_setopt($rest,curlopt_port,443); curl_setopt($rest,curlopt_post,1); curl_setopt($rest,curlopt_postfields,$push_payload); curl_setopt($rest,curlopt_httpheader, array("x-parse-application-id: " . $appid, "x-parse-rest-api-key: " . $restkey, "content-type: application/json")); $response = curl_exec($rest);
use set_time_limit(0);
page doesn't timeout.
you try using curl_milti
parallel curl requests. not avoid timeout if requests many.
Comments
Post a Comment