我尝试向 Piwik 提交 Delphi POST 请求,如下所述:http: //piwik.org/docs/tracking-api/reference/#toc-advanced-bulk-tracking-requests。
我的 Delphi 实现如下所示:
FPiwikRequest := '';
FPiwikRequest := FPiwikRequest + Format('?cvar=PAGE_%s&', ['something']);
FPiwikRequest := FPiwikRequest + Format('action_name=6new_%s&', ['ActionPage']);
FPiwikRequest := FPiwikRequest + Format('idsite=%d&', [3]);
FPiwikRequest := FPiwikRequest + Format('rec=%d&', [1]);
FPiwikRequest := FPiwikRequest + Format('url=%s&', ['http://localhost/analytics/index45.html']);
FPiwikRequest := FPiwikRequest + Format('urlref=%s&', ['http://localhost/analytics/index13.html']);
FPiwikRequest := FPiwikRequest + Format('_id=%s&', ['231e3849e534a3c6']);
FPiwikRequest := FPiwikRequest + Format('rand=%d', [Random(1000)]);
json := SO;
json.O['requests'] := SA([]);
json.A['requests'].S[0] := FPiwikRequest;
json.A['requests'].S[1] := FPiwikRequest_2;
json.S['token_auth'] := 'ffff9fb80b9558e4529fe96902dffff';
FPiwikRequest := json.AsString;
HTTPClient.POST(PIWIK_HOME + FPiwikRequest, response); //HTTPClient => idHTTP class
提交请求后,Piwik 脚本仅处理提交的批量请求中的最后一个请求 json.A['requests'].S[1]。
*当我从 Python 提交相同的批量请求时,Piwik 会处理来自提交的批量请求的两个请求。
您对这种 Delphi POSTing 行为有任何想法吗?