Init
This commit is contained in:
18
ajax/ems.php
Normal file
18
ajax/ems.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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);
|
||||
Reference in New Issue
Block a user