$user_id, 'token' => $token, 'shortname' => $shortname, 'secret' => $secret, 'dynamic_attribute' => 'NAS-Identifier', 'dynamic_value' => $shortname, "$realm_1" => true, ); // Setup cURL $ch = curl_init($url); curl_setopt_array($ch, array( CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), CURLOPT_POSTFIELDS => json_encode($postData) )); // Send the request $response = curl_exec($ch); // Check for errors if($response === FALSE){ die(curl_error($ch)); } // Decode the response $responseData = json_decode($response, TRUE); //print_r($responseData); //====================================================== if($responseData['success'] == true){ $id = $responseData['data']['id']; print("Newly added id is $id\n"); //--- We now need to modify this entry by specifying a few things: // The data to send to the API $editData = array( 'community' => $mac, 'heartbeat_dead_after' => 300, 'id' => $id, 'monitor' => 'heartbeat', 'nasidentifier' => $shortname, 'session_auto_close' => 'session_auto_close', 'session_dead_time' => 3600, 'type' => 'CoovaChilli-Heartbeat', 'token' => $token ); // Setup cURL $ch_e = curl_init($url_edit); curl_setopt_array($ch_e, array( CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), CURLOPT_POSTFIELDS => json_encode($editData) )); // Send the request $response_e = curl_exec($ch_e); // Check for errors if($response_e === FALSE){ die(curl_error($ch_e)); } // Decode the response $responseData_e = json_decode($response_e, TRUE); print_r($responseData_e); } //========================================================= } ?>