Grabbing Device Tokens from Urban Airship Grabbing Device Tokens from Urban Airship curl curl

Grabbing Device Tokens from Urban Airship


 <?php$appKey = '<Your App Key>';$appSecret = '<Your App Master Secret>';$fetchedDeviceTokens = array();$url = "https://go.urbanairship.com/api/device_tokens/";for ($x=0; $x<=100000; $x++) {    $curl = curl_init($url);    curl_setopt($curl, CURLOPT_HEADER, false);    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);    curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));    curl_setopt($curl, CURLOPT_POST, false);    curl_setopt($curl, CURLOPT_USERPWD, $appKey .":".$appSecret);     $json_response = curl_exec($curl);    $res = json_decode($json_response);    $nextURL = $res->next_page;       $deviceTokensObjectArray = $res->device_tokens;    foreach($deviceTokensObjectArray as $val){        $deviceToken = $val->device_token;        $fetchedDeviceTokens[] = $deviceToken;    }    if($nextURL){        $url = $nextURL;    }    else{        break;    }    } foreach($fetchedDeviceTokens as $val){//USE THIS LOOP TO INSERT INTO YOR DATABASE OR CREATE AN XML ETC. }?>