クライアント
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; //参照設定 Microsoft XML, v6.0 using MSXML2; namespace Post_Db { public partial class Form1 : Form { private string DoPost() { XMLHTTP xh = new XMLHTTP(); string param = @"&key=xxx&name=" + Environment.MachineName; xh.open("POST", "http://xxx/post.php", false); xh.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xh.send(param); return xh.responseText; } public Form1() { InitializeComponent(); DoPost(); } } } |
あるいは、
1 2 3 |
require 'net/http' res = Net::HTTP.post_form(URI.parse('http://xxx.com/post.php'), {'key'=>'xxx'}) |
Winならタスクスケジュール、ubuntuならCRONに設定しておくと、
定期的にWan側のIPがレンサバに表示できるので、そのWan側のIPを使って、
SoftEtherをダイナミックDNSではなく、IP直打ちもできる。
xxx.xxx.xxx.xxx/192.168.xxx.xxxのような感じで入力する。
post.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php ini_set("display_errors","On"); ini_set("error_reporting",E_ALL); class App{ private function main(){ if(array_key_exists("key",$_POST) && $_POST["key"] == "xxx"){ $current = file_get_contents("_index.html"); $current = "Name:" . $_POST["name"] . " / Date:" . date("Y/m/d H:i:s") . " " . $current; file_put_contents("_index.html", $current); } } public function __construct(){ $this->main(); } } new App; |
s.css
1 2 3 4 5 6 |
*{font-size:18px;} a{text-decoration:none;} @media screen and (max-device-width: 480px) { *{font-size:32px;} a{font-size:64px;} } |