時間は日本時間でOKだよ
cd /home/<ユーザー名>/public_html/<実行するPHPコードのパス>;/usr/bin/php hogehoge.php
ネタ元
時間は日本時間でOKだよ
cd /home/<ユーザー名>/public_html/<実行するPHPコードのパス>;/usr/bin/php hogehoge.php
ネタ元
ファイル読み込み
<?php $data = file_get_contents("sample.txt"); ?>
<?php $fp = fopen("sample.txt", "r"); while ($line = fgets($fp)) { echo "$line<br />"; } fclose($fp); ?>
ファイル書き込み
<?php file_put_contents("sample.txt", "ファイルへの書き込みサンプル"); ?>
<?php $fp = fopen("sample.txt", "w"); fwrite($fp, "ファイルへの書き込みサンプル"); fclose($fp); ?>
ファイル追記
<?php $fp = fopen("sample.txt", "a"); fwrite($fp, "ファイルへの追記サンプル"); fclose($fp); ?>
ネタ元
CME日経先物の最新四本値取得
$html = file_get_contents("http://www.cmegroup.com/trading/equity-index/international-index/nikkei-225-yen_quotes_settlements_futures.html"); $dom = new DOMDocument(); @$dom->loadHTML($html); $xml = simplexml_import_dom($dom); $ret = $xml->xpath("//*[@id=\"cmeTradeDate\"]/option[@selected='selected']"); //var_dump($ret); $yyyymmdd = "19000101"; foreach( $ret as $e ){ $yyyy = substr($e["value"],6,4); $mm = substr($e["value"],0,2); $dd = substr($e["value"],3,2); $yyyymmdd = $yyyy . $mm . $dd; //echo $yyyymmdd; //echo $e; } $ret = $xml->xpath("//*[@id=\"settlementsFuturesProductTable\"]/tbody/tr[1]"); //var_dump($ret); $outStr = ""; foreach( $ret as $e ){ $open = $e->td[0]; $high = $e->td[1]; $low = $e->td[2]; $last = $e->td[3]; $last = substr($last,0,-1); $volume = $e->td[6]; $volume = str_replace(",","",$volume); $outStr = "," . $yyyymmdd . "," . $open . "," . $high . "," . $low . "," . $last . "," . $volume; }
ChromeでXpath取得したとき、tbody入ってる場合、抜かないとエラーになることある
HtmlAgilityPackを使うにはプロジェクトごとにNuGetから導入する。
コード例
Dim wc As WebClient = New WebClient() Dim htmlStr As String htmlStr = wc.DownloadString("http://www.cmegroup.com/trading/equity-index/international-index/nikkei-225-yen_quotes_settlements_futures.html#tradeDate=11/22/2016") Dim html As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument() html.LoadHtml(htmlStr) Dim tags As HtmlAgilityPack.HtmlNodeCollection tags = html.DocumentNode.SelectNodes("//*[@id=""settlementsFuturesProductTable""]/tbody/tr[1]") Dim node As HtmlAgilityPack.HtmlNode For Each node In tags Trace.WriteLine(node.InnerText) Next
ネタ元
・さくらのコントロールパネルでドメインを設定
・さくらのファイルマネージャーでドメインをアップするフォルダを作成
・お名前.comでネームサーバーを変更
・さくらのファイルマネージャーでアクセス設定
ネタ元
こんな感じでシート保護を設定(UIのみ)を設定する
Option Explicit Private Sub Workbook_Open() ' 一旦、シート保護を解除 ActiveSheet.Unprotect ' シート保護を設定(UIのみ) ActiveSheet.Protect UserInterfaceOnly:=True ActiveWindow.ScrollRow = 1 End Sub
ネタ元