Answer the question
In order to leave comments, you need to log in
application not exist?
The task is to log in through Odnoklassniki, and use the received data later on the site
. The found PHP script is used for this
<?php
$AUTH['client_id'] = '1248204544';
$AUTH['client_secret'] = '*******************';
$AUTH['application_key'] = '**********************';
if (isset($_GET['code'])) {
$curl = curl_init('http://api.odnoklassniki.ru/oauth/token.do');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, 'code=' . $_GET['code'] . '&redirect_uri=' . urlencode($HOST . 'auth.php?name=odnoklassniki') . '&grant_type=authorization_code&client_id=' . $AUTH['client_id'] . '&client_secret=' . $AUTH['client_secret']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$s = curl_exec($curl);
curl_close($curl);
$auth = json_decode($s, true);
$curl = curl_init('http://api.odnoklassniki.ru/fb.do?access_token=' . $auth['access_token'] . '&application_key=' . $AUTH['application_key'] . '&method=users.getCurrentUser&sig=' . md5('application_key=' . $AUTH['application_key'] . 'method=users.getCurrentUser' . md5($auth['access_token'] . $AUTH['client_secret'])));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$s = curl_exec($curl);
curl_close($curl);
$user = json_decode($s, true);
//* Печать данных в массиве
echo "<pre>";
print_r($user);
echo "</pre>";
//* Печать данных в массиве
} else header('Location: http://www.odnoklassniki.ru/oauth/authorize?client_id=' . $AUTH['client_id'] . '&scope=VALUABLE_ACCESS&response_type=code&redirect_uri=https://www.aaa.com/okru');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question