function sendRequest($HTTPSURL) { loadCoreFile('bouncer.php'); $bnc = new Bouncer(); $bnc->setMethod('GET'); $bnc->setGETstring($bnc->prepareDATAstring(array("request" => "is_connection_available"))); $bnc->setURL($HTTPSURL . "avactis-system/admin/test_connection.php"); $result = $bnc->RunRequest(); $URL_correct = false; if (is_array($result) && isset($result["body"]) && strstr($result["body"], "YES")) { $URL_correct = true; } return $URL_correct; }
function __getRateFromWebServiceX($from, $to) { loadCoreFile('bouncer.php'); $bnc = new Bouncer(); $bnc->setHTTPversion("1.0"); $bnc->setMethod("GET"); $bnc->setURL("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate"); $bnc->setSocketReadTimeout(10); $get_params = array("FromCurrency" => $from, "ToCurrency" => $to); $bnc->setGETstring($bnc->prepareDATAstring($get_params)); $res = $bnc->RunRequest(); if ($res != false) { $xml = $res["body"]; loadCoreFile('obj_xml.php'); $parser = new xml_doc($xml); $parser->parse(); foreach ($parser->xml_index as $node) { if ($node->name = "DOUBLE") { $rate = $node->contents; if ($rate == 0) { $rate = false; } $this->__addRequestToTimeline('www.webservicex.net', $from, $to, $rate, $bnc, $res); return $rate; } } } $this->__addRequestToTimeline('www.webservicex.net', $from, $to, false, $bnc, $res); return false; }
function __makeTestHttpsRequest($get_array, $url) { loadCoreFile('bouncer.php'); $bnc = new Bouncer(); if (!$bnc->isSSLavailable()) { return "SSL_not_available"; } $bnc->setMethod('GET'); $bnc->setGETstring($bnc->prepareDATAstring($get_array)); $bnc->setURL($url); $result = $bnc->RunRequest(); if (is_array($result) && isset($result["body"]) && strstr($result["body"], "YES")) { return true; } else { return false; } }