<?php
$first = $_GET['coin_two'];
$last = $_GET['coin'];
$give = $_GET['give'];
$res = file_get_contents("https://bittrex.com/api/v1.1/public/getorderbook?market=$first-$last&type=both");
$array = json_decode($res, true);
$val = $array['result']['buy'][0]['Rate'];
//$val = intval($val);
$value = ($give*$val)*0.96;
print_r($value);
?>
<?php
// Заказывали класс
class Any
{
public function any()
{
$first = $_GET['coin_two'];
$last = $_GET['coin'];
$give = $_GET['give'];
$res = file_get_contents("https://bittrex.com/api/v1.1/public/getorderbook? market=$first-$last&type=both");
$array = json_decode($res, true);
$val = $array['result']['buy'][0]['Rate'];
//$val = intval($val);
$value = ($give*$val)*0.96;
return $value;
}
}
$obj = new Any();
?>
<script>
// Заказывали JQuery
$(document).ready(function(){
alert('<?php print_r($obj->any());?>');
});
</script>