|
Меню
Общие сведенияbilling help news partner prefix project sms url gpay soap |
Общие сведения по использованию GOLDFON API
Маршрутизация в API GOLDFON
Строка запроса к API GOLDFON: http://api.goldfon.ru/:format/:controller/[:action]/[:method]/[encoding/:encoding/]* или http://api.goldfon.ru/:format/:controller/[action]/[method]?[encoding=:encoding&]* Строка запроса к API GOLDFON, требующего аутентификации: http://api.goldfon.ru/:format/:controller/[:action]/[:method]/uid/:uid/sid/:sid/[encoding/:encoding/]* или http://api.goldfon.ru/:format/:controller/[action]/[method]/uid/:uid/sid/:sid?[encoding=:encoding&]* Строка запроса к API GOLDFON, требующего аутентификации с дополнительным параметром hash: http://api.goldfon.ru/:format/:controller/[:action]/[:method]/uid/:uid/[encoding/:encoding/]hash/:hash/* или http://api.goldfon.ru/:format/:controller/[action]/[method]/uid/:uid?[encoding=:encoding&]hash=:hash&*
Пример запроса: http://api.goldfon.ru/php/url/create/uid/99999/short/short_url?url=http%3a%2f%2ftesturl.com&hash=0290b6e7cfdba475b8a755e2d7184f1ab21eea50 Пример кода:
$to = '71234567890'; // Номер телефона получателя
$text = urlencode('Тестирование!'); // Текст SMS
$from = urlencode('6005'); // Отправитель в тексте SMS
$uid = '1234567'; // ID партнёра в системе
// Формирование строки запроса без хэша
$base_url = "http://api.goldfon.ru/php/sms/delivery/send?uid={$uid}&from={$from}&encoding=win&to={$to}&text={$text}";
$pass_hash = '012abc012def'; // ЭЦП партнёра
$url_hash = sha1($base_url . $pass_hash); // Хэш запроса
// Добавляем к строке запроса хэш запроса
//echo $base_url . '&hash=' . $url_hash;
$out = file_get_contents($base_url . '&hash=' . $url_hash);
echo $out;
|