start

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
start [2022/10/16 09:32] ともやんstart [2023/09/10 13:25] (現在) ともやん
行 136: 行 136:
 ====== Dokuwiki Top ====== ====== Dokuwiki Top ======
 <php> <php>
-function curlGet($url) {+function curlGet($url, $referer='') {
   $curl = curl_init();   $curl = curl_init();
      
行 143: 行 143:
   curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 証明書の検証を行わない   curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 証明書の検証を行わない
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);  // curl_execの結果を文字列で返す   curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);  // curl_execの結果を文字列で返す
 +  curl_setopt($curl, CURLOPT_REFERER, $referer);
      
   $response = curl_exec($curl);   $response = curl_exec($curl);
行 151: 行 152:
  
 //$json = curlGet('https://www.gaitameonline.com/rateaj/getrate'); //$json = curlGet('https://www.gaitameonline.com/rateaj/getrate');
-$json = curlGet('https://info.finance.yahoo.co.jp/fx/async/getRate'); +//$json = curlGet('https://info.finance.yahoo.co.jp/fx/async/getRate'); 
-$json = mb_convert_encoding($json, 'UTF8', 'ASCII,JIS,UTF-8,EUC-JP,SJIS-WIN');+//$json = curlGet('https://finance.yahoo.co.jp/web-fx/ajax', 'https://finance.yahoo.co.jp/quote/USDJPY=FX'); 
 +$html = curlGet('https://www.google.com/finance/quote/USD-JPY'); 
 +//$html = curlGet('https://www.google.com/finance/quote/CNH-JPY'); 
 +$html = mb_convert_encoding($html, 'UTF8', 'ASCII,JIS,UTF-8,EUC-JP,SJIS-WIN'); 
 +preg_match_all('/AF_initDataCallback\(\{.*?(?<json>.*?)\}\);/', $html, $matchs); 
 +$html = $matchs['json'][3]; 
 +$json = json_encode($matchs['json']); 
 +//$json = json_decode($matchs['json'][1], false); 
 //$usdjpy = json_decode($json, true)['quotes'][20]; //$usdjpy = json_decode($json, true)['quotes'][20];
-$usdjpy = json_decode($json, true)['USDJPY']; +echo '<script>'; 
-$cnhjpy = json_decode($json, true)['CNHJPY'];+echo 'var quotes = ' . $json . ';'; 
 +echo '</script>'; 
 +$usdjpy = []; //json_decode($json, true)['USDJPY']; 
 +$cnhjpy = []; //json_decode($json, true)['CNHJPY'];
  
 +//print_r($matchs['json']);
 +//print_r($json);
 +//print_r($html);
 //print_r($usdjpy); //print_r($usdjpy);
  
行 230: 行 245:
 [[web:brave|Brave - プライバシーを重視した高速かつ安全な次世代ブラウザ]]\\ [[web:brave|Brave - プライバシーを重視した高速かつ安全な次世代ブラウザ]]\\
 の利用をお勧めします😉\\ の利用をお勧めします😉\\
-\\ +
-<wrap em>※スマホで閲覧する場合は Chromium 系エンジンのブラウザでの閲覧はおすすめしません🤔\\ +
-ページによっては大量の出力結果を含むため、__レンダリング処理でプチフリーズ__します😱😇\\ +
-快適に閲覧するには [[https://www.mozilla.org/ja/firefox/|Firefox]] での閲覧を推奨します😊\\ </wrap>+
  • start.1665880327.txt.gz
  • 最終更新: 2022/10/16 09:32
  • by ともやん