#!/usr/bin/perl print "Content-type: text/html\n\n"; BEGIN { use lib '/usr/home/cfg' ; require push_inc ; } require cfg ; &today ; #------------------------------------------------------------------------------------------ @ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'}); my $curr = $ARGV[0] ; # https://www.itvadmin.co.za/cgi-bin/scripts/get/get_roe.pl?GBP unless (length($curr) == 3) { exit ; } # $curr not used other than as a check to make sure this is being run properly #------------------------------------------------------------------------------------------ # use DBI; use CGI::Carp qw(fatalsToBrowser); use Fcntl qw(:flock); &get_roe ; print $json ; exit ; #------------------------------------------------------------------------------------------ sub get_roe { our %roe = () ; $roe{USD} = 1 ; &common_exchange_rates ; # foreach my $curr (keys %roe) { push @json, "'$curr':'$roe{$curr}'" ; } my $sell_rate = $roe{$curr} ; my $buy_rate = $roe_buy{$curr} ; # if ($curr eq 'ZAR') { # $sell_rate = sprintf("%.0f", $roe{$curr}) ; # $buy_rate = sprintf("%.0f", $roe_buy{$curr}) ; # } $json = '[{' ; $json .= qq("sell_rate":"$sell_rate","buy_rate":"$buy_rate"); $json .= '}]' ; } #------------------------------------------------------------------------------------------ use db ; use today ; use common ; 1;