환율 정보 소스를 얻어서 적용 했었습니다. 채택완료
그동안 잘 되다가 -1 로만 출력이 되네요 ㅠㅠ
고수님들 뭐가 잘못된걸까요? 주소가 바뀐건가 싶기도 하구요. ㅠㅠ
이하 잘 되던 소스 첨부 합니다.
echo get_currency("PHP", "KRW"); /* * Retrieve real-time currency from Yahoo Finance * * @param string $from_currency e.g.) AUD * @param string $to_currency e.g.) KRW * @access public * @return float -1 as false, positivle float value as currency value * */ function get_currency($from_currency, $to_currency) { $url = 'http://download.finance.yahoo.com/d/quotes.csv?s=" target="_blank">http://download.finance.yahoo.com/d/quotes.csv?s='.$from_currency.$to_currency.'=X&f=sl1d1t1c1ohgv&e=.csv'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $currency_csv = curl_exec($ch); curl_close ($ch); $csv_data = explode(',', $currency_csv); $currency_value = -1; if(sizeof($csv_data) == 9 && isset($csv_data[1])) { $currency_value = (float)$csv_data[1]; $currency_value = number_format($currency_value,2, '.', ''); // FIXME: Do Something } unset($csv_data); unset($currency_csv); return $currency_value; }
?>
답변 1개
야후에서 정책문제로 더이상 서비스 하지 않는 것같아요.
다른 api 사용하셔야 할 것같습니다
https://www.stockopedia.com/content/yahoo-finance-no-longer-working-in-excel-237203/" target="_blank">https://www.stockopedia.com/content/yahoo-finance-no-longer-working-in-excel-237203/
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인