GET call in PHP
GET call example in PHP
$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 ...) // Prepare data for hashing $request_method = 'GET'; $request = 'https://www.1ka.si/admin/survey/api/api.php?'.$params; $data = $request_method . $request; // 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_CUSTOMREQUEST, $request_method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute call $result = curl_exec($ch);