Files

19 lines
749 B
PHP
Raw Permalink Normal View History

2026-02-14 19:34:54 +03:00
<?php
session_start();
chdir('..');
require_once('api/Simpla.php');
$simpla = new Simpla();
if($to = $simpla->request->get('to', 'string')){
$weight = max(1, $simpla->request->get('weight'));
$data = file_get_contents('http://emspost.ru/api/rest?method=ems.calculate&from='.$simpla->settings->emsfrom.'&to='.$to.'&weight='.$weight);
$data = json_decode($data);
$simpla->design->assign('all_currencies', $simpla->money->get_currencies());
$simpla->design->assign('data', $data);
$result = $simpla->design->fetch('ajax_price.tpl');
}
header("Content-type: application/json; charset=UTF-8");
header("Cache-Control: must-revalidate");
header("Pragma: no-cache");
header("Expires: -1");
print json_encode($result);