K
K
Khurshed Abdujalil2017-03-07 08:07:45
Classmates
Khurshed Abdujalil, 2017-03-07 08:07:45

How to correctly generate the signature sign Api Odnoklassniki?

I was looking for a solution, even I didn’t find a good
answer .

$params = array(
      "application_key"=>$ok_public_key,
      "method"=>"mediatopic.post",
      "gid"=> $groupID,
      "type"=>"GROUP_THEME",
      "attachment"=>'{"media": ['.implode(',', $attachment).']}',
      "format"=>"json"
    );

$sig = md5($this->arInStr($params).md5("{$ok_access_token}{$ok_private_key}"));

public function arInStr($array) {
    ksort($array);
    $string = "";
    foreach($array as $key=>$val) {
      if (is_array($val)) {
        $string .= $key."=".$this->arInStr($val);
      } else {
        $string .= $key."=".$val;
      }
    }
    return $string;
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery Ozhiganov, 2017-03-09
@akhur

It is worth trying to reproduce the request on the call form in the documentation.
It will show how the signature is considered.
https://apiok.ru/dev/methods/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question