From d35969ab0e4536adbc2bb10addd0b728233641ae Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 20 Oct 2014 14:42:35 +0800 Subject: [PATCH] UpdateCurrencyRate.php --- UpdateCurrencyRate.php | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/UpdateCurrencyRate.php b/UpdateCurrencyRate.php index c0e1c60c..749d9603 100644 --- a/UpdateCurrencyRate.php +++ b/UpdateCurrencyRate.php @@ -29,6 +29,52 @@ class Pman_Core_UpdateCurrencyRate extends Pman { echo"'update currency exchange rate \n"; + $params = array( + 'lang' => 'en', + 'result' => 1, + 'date1' => '10/14/14', + 'date'=> '10/20/14', + 'date_fmt' => 'us', + 'exch' => 'CNY', +// exch2: + 'expr' => 'USD', +// expr2: + 'margin_fixed' => 0, + 'format'=> 'HTML', +// SUBMIT:Get Table + ); + + } + + function curl($url, $request = array(), $method = 'GET') + { + + if(is_array($request)){ + $request = http_build_query($request); + } + + $url = $url . ($method == 'GET' ? "?" . $request : ''); + $ch = curl_init($url); + + if ($method == 'POST') { + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $request); + curl_setopt($ch, CURLOPT_HTTPHEADER, + array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($request))); + } + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_VERBOSE, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 30); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + + $response = curl_exec($ch); + + curl_close($ch); + + return $response; } /* -- 2.39.2