首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的PlayFab重置email API POST请求似乎没有有效负载

我的PlayFab重置email API POST请求似乎没有有效负载
EN

Stack Overflow用户
提问于 2022-03-03 20:48:59
回答 1查看 80关注 0票数 -2

我试图向以下PlayFab API提交一个php响应:https://learn.microsoft.com/en-us/rest/api/playfab/admin/account-management/reset-password?view=playfab-rest

这是我的第一个php脚本,我已经使用这个脚本很长一段时间了,并且能够运行我的脚本而没有错误,但是我似乎没有负载。

代码中的回声:

回应了“resp:”.$resp;

来自上述回波的...response是:

的resp:字符串(0) "“

不幸的是,我真的不知道哪里出了问题,也不知道如何修复它,因为没有错误消息。我尝试回显$options数组以控制是否存在有效负载,但没有成功。我意识到我需要帮助,我会非常感激的。

代码语言:javascript
复制
$url = "https://titleId.playfabapi.com/Admin/ResetPassword/json/";

        $data = array('Password' => $pw1, 'Token' => $params['token']);

        $options = array(
            'http' => array(
                'method'  => 'POST',                    
                'content' => http_build_query($data),
                'header' => 'X-SecretKey: xxxxxxxxxxxx\r\n',
                'ignore_errors' => true
            )
        );

        $context  = stream_context_create($options);
        $resp = file_get_contents($url, false, $context);
        echo ' The resp: ' .$resp;
        var_dump($resp);
EN

回答 1

Stack Overflow用户

发布于 2022-03-12 17:44:21

好的,这是解决办法。我能够让它在邮递员中工作,当我测试代码时,它就能工作了。

下面是起作用的片段:

代码语言:javascript
复制
echo '>>>>>>>>>> TEST <<<<<<<<<<';

    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => 'https://99999.playfabapi.com/Admin/ResetPassword?Password=pekapeka&Token=1B5A9C01EFD5DB69',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_HTTPHEADER => array(
            'X-SecretKey: xxxxxxx',
            'Content-Type: application/json\\'
        ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);
    echo $response;
    print_r($response);

    echo '<br>========== END ==========';
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71343622

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档