圣骑士API问题要创建会话

发布于 2025-02-13 16:42:57 字数 915 浏览 1 评论 0 原文

我想使用paladins API来制作统计网站,但是当我发送http请求创建会话时,我会从API中获得此错误,从API:

string(113)(113)“ {” {“ ret_msg”:“处理时” :无效的日期格式,“ session_id”:“”,“ Timestamp”:“ 7 \/6 \/2022 3:49:56 pm”}“

问题似乎是时间戳参数。可以肯定的是,我看着

我尝试了几个时间戳,但仍然卡在这里。请注意,我可以成功使用API​​,因此这不是服务器问题: 字符串(99)“” paladinsapi(VER 0.0.41.17634)[patch -5.4] - Ping成功。服务器日期:7 \/6 \/2022 4:05:18 pm“”

这是我的代码:

$ping = file_get_contents("https://api.paladins.com/paladinsapi.svc/pingJson");
var_dump($ping);

$createSession = file_get_contents("https://api.paladins.com/paladinsapi.svc/createsessionJson/myDevId/myDevPaswd/".strval(time()));
var_dump($createSession);

这是我的问题:有人已经使用了此API和/或知道我的代码有什么问题?还是有人知道将什么作为时间戳参数来使我的请求起作用?

I would like to use Paladins API to make a stats website but when I send an HTTP request to create a session I get this error as answere from the API:

string(113) "{"ret_msg":"Exception while processing: Invalid date format","session_id":"","timestamp":"7\/6\/2022 3:49:56 PM"}"

The problem seems to be timestamp parameter. For sure I looked at API documentation but no further information on what to put as timestamp:

enter image description here

I've tried several timestamp but still stucked here. Note that I can successfully ping the API so that's not a server issue:
string(99) ""PaladinsAPI (ver 0.0.41.17634) [PATCH - 5.4] - Ping successful. Server Date:7\/6\/2022 4:05:18 PM""

Here is my code:

$ping = file_get_contents("https://api.paladins.com/paladinsapi.svc/pingJson");
var_dump($ping);

$createSession = file_get_contents("https://api.paladins.com/paladinsapi.svc/createsessionJson/myDevId/myDevPaswd/".strval(time()));
var_dump($createSession);

So here is my question: do someone already used this API and/or know what's wrong with my code? Or do someone know what to put as timestamp parameter to make my request work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

讽刺将军 2025-02-20 16:42:58

我看了看放置的更多信息

您确定这是 ?本文档的第18页上包含的示例API调用明确显示了如何格式化的示例API调用,即 yyyymmddhhmmss

$api = file_get_contents("https://api.paladins.com/paladinsapi.svc/createsessionJson/myDevID/myDevPaswd/".date("YmdHis"));

I looked at API documentation but no further information on what to put as timestamp

Are you sure about this? The example API call included on page 18 of this document shows explicitly how this is expected to be formatted, which is yyyyMMddHHmmss.

Using the format identifiers on PHP: DateTime::format, you could do something along the lines of:

$api = file_get_contents("https://api.paladins.com/paladinsapi.svc/createsessionJson/myDevID/myDevPaswd/".date("YmdHis"));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文