私はC#のコンソールアプリで作成した。
static void Main(string[] args)
{
// リクエスト
string url = "http://upload1.myfxbook.com/upload.html?id=foofoo&pass=barbar";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.KeepAlive = true;
req.ContentType = "application/octet-stream";
req.Accept = "*/*";
req.ServicePoint.Expect100Continue = false;
// 送信ファイル
string filePath = "C:/statement.csv";
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
req.ContentLength = fs.Length;
// 送信
Stream reqStream = req.GetRequestStream();
byte[] readData = new byte[0x1000];
int readSize = 0;
while (true) {
readSize = fs.Read(readData, 0, readData.Length);
if (readSize == 0) {
break;
}
reqStream.Write(readData, 0, readSize);
}
fs.Close();
reqStream.Close();
}
POSTの仕組みは、ほとんどどこかのサンプルソースをコピったのは内緒。
そしてホントはレスポンスを取ったりすべきなんだろうけど、省いちゃった。
送信先URLのパラメータは、「id」にMyfxbookのアカウント番号を指定する。
「pass」には、Myfxbookにログインする際のパスワードを指定する。
あとは実行するだけ。
こんな面倒なことをする人はあまりいないと思うが、
その気になればいくらでも良い成績をでっちあげて公開することができる。
ただ、もちろんこの方法では、Myfxbookの2つの認証機能は赤バッテンのまま。
ちゃんと緑チェックになっている成績以外は、信用しないほうがいいということ。
0 件のコメント:
コメントを投稿