Файл: token.php
Строк: 25
<?php
$client_id = "85430726A2F1E810F0C94FABACA1FA89B7C294F0CE92DEF9C8A0D68F1B450778";
$client_secret = "CB4C37662B43C978EAFEB8B873067EC855BD9DAA8F1E51293A852358B5BB5A0E7B88CDFE217F031B74883454B48C84137D647417E915F5DA2A57E452DE321D67";
$redirect_uri = "http://wordpay.ru/token.php";
if (empty($_GET['code'])) {
$url = "https://money.yandex.ru/oauth/authorize";
if($curl = curl_init()) {
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_POSTFIELDS, "client_id=".$client_id ."&response_type=code&redirect_uri=" . $redirect_uri . "&scope=account-info operation-details payment-p2p payment-shop");
$out = curl_exec($curl);
curl_close($curl); }
} else {
$url = "https://money.yandex.ru/oauth/token";
if($curl = curl_init()) {
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_POSTFIELDS, "code=".$_GET["code"]."&client_id=". $client_id . "&grant_type=authorization_code&redirect_uri=" . $redirect_uri . "&client_secret=" . $client_secret);
$out = curl_exec($curl);
curl_close($curl); }
}