function __getRateFromGoogle($from, $to) { return false; // it is better not to use it now, 'cause it's a bit erratical loadCoreFile('bouncer.php'); $bnc = new Bouncer(); $bnc->setHTTPversion("1.0"); $bnc->setMethod("GET"); $bnc->setURL("http://www.google.com/search"); $bnc->setSocketReadTimeout(20); $get_params = array("hl" => "en", "q" => $from . " in " . $to, "btnG" => "Search"); $bnc->setGETstring($bnc->prepareDATAstring($get_params)); $bnc->setAdditionalHeaders(array('User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.2; ru; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1;fdnet', 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language' => 'ru,en-us;q=0.7,en;q=0.3', 'Accept-Encoding' => '', 'Accept-Charset' => 'windows-1251')); $res = $bnc->RunRequest(); if ($res != false) { $responce = $res["body"]; preg_match("/= ([0-9\\.]+)/i", $responce, $matches); if (isset($matches[1]) && Validator::isValidFloat($matches[1])) { $rate = round($matches[1], 4); $this->__addRequestToTimeline('www.google.com', $from, $to, $rate, $bnc, $res); return $rate; } } $this->__addRequestToTimeline('www.google.com', $from, $to, false, $bnc, $res); return false; }