Файл: app/merchant/test.php
Строк: 24
<?php
$client_id = '78092F7167A5EFD74E87EB81CDAC00B1FD46A90304C4AEC2B36CBB0CA8FE9035';
$client_secret = 'D1469AB4C492BB7CE77932403DB72D6E5B2486166543DF370D4812072A6244C69CAF4EBA88BB6319F2556202BE0220A491CEA07261DB0D19062C5E0D9619E504';
$redirect_uri = 'https://uspay.ru/api/test';
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-history operation-details payment-p2p");
$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); }
}