这是我尝试使用的一段代码,用于POST
从 MQL4 脚本到名为 upload.php 的外部 php 脚本的一组 13 个参数值
string headers = "Content-Type: application/x-www-form-urlencoded";
string data = "{\"ohlcVectors\":{\"ticker\":\"dax\",\"barIntervalSeconds\":300,\"open\":[6844.2998046875," +
"6847.7998046875]},\"className\":\"MAIndicator\",\"parameters\":{\"periods\":2}}";
string acceptTypes[1] = {"*/*"};
int HttpOpen = InternetOpenA( "HTTP_Client_Sample", 1, NULL, NULL, 0 );
int HttpConnect = InternetConnectA( HttpOpen, "127.0.0.1", 7777, NULL, NULL, 3, 0, 1 );
int HttpRequest = HttpOpenRequestA( HttpConnect, "POST", "/tradesheet/upload.php", NULL, NULL, acceptTypes, 0, 1 );
HttpSendRequestA( HttpRequest, headers, StringLen( headers ), data, StringLen( data ) );
编译器不断抛出一个data
不兼容类型的错误。data
当我正在寻找MQL4
将参数发送到 php.ini 的方法时,该字符串是从站点中获取POST
的。但我需要那个字符串data
有我自己的参数值,但不知道如何把它放在正确的格式。
我尝试了很多搜索,但找不到任何有用的东西。
以下是我需要发送到upload.php 的参数列表。有人可以帮我安排HttpSendRequestA()
预期的格式吗?
string params[13][13];
params[0][0] = "x1";
params[0][1] = "GOD@GMAIL.com";
params[1][0] = "x2";
params[1][1] = 10000;
params[2][0] = "x3";
params[2][1] = 10000;
params[3][0] = "x4";
params[3][1] = "fxpro";
params[4][0] = "x5";
params[4][1] = "usd";
params[5][0] = "x6";
params[5][1] = 10000;
params[6][0] = "x7";
params[6][1] = 5000;
params[7][0] = "x8";
params[7][1] = 10;
params[8][0] = "x9";
params[8][1] = 10;
params[9][0] = "x10";
params[9][1] = "sdfskfms";
params[10][0] = "x11";
params[10][1] = 232;
params[11][0] = "x12";
params[11][1] = 230;
params[12][0] = "x13";
params[12][1] = "fxpro";
万分感谢