POST call example in PHP

Error message

Notice: Undefined index: cms_login_title in prijava_1ka_block_view() (line 265 of /var/www/1ka.si/www/frontend/drupal/sites/all/modules/prijava_1ka/prijava_1ka.module).
$identifier = '9b03c8cdf967d24a';
$private_key = '0a68ff8b77272baf5a04f3b656f27fb5250438bc21d7707515a1b506a3a8491b';

// GET params
$params = 'action=getSurveyQuestions'; // Function to execute
$params .= '&ank_id=705'; // parameters needed for function execution (survey id, question id ...) 

// POST data
$post_data = array(
 "naslov" => "Naslov vprašanja...",
 "vrednost" => "123",
);

// Prepare data for hashing
$request_method = 'POST';
$request = 'https://www.1ka.si/admin/survey/api/api.php?'.$params;
$raw_post_data = http_build_query($post_data);

$data = $request_method . $request . $raw_post_data;

// Calculate hash (token)
$token = hash_hmac('sha256', $data, $private_key);

// Prepare call – we add parameters 'identifier' and 'token' 
$ch = curl_init($request.'&identifier='.$identifier.'&token='.$token);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data)); // JSON string for POST
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_method);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute call
$result = curl_exec($ch);