question

peterkallviks avatar image
peterkallviks asked

How to: POST https://titleId.playfabapi.com/Admin/ResetPassword

I have no experience with php and related programming and have spent the last couple of days to try to figure out how to create php code to post ResetPassword.

I have succeeded to create a php script (my first) that reads the callback URL and parse the Token but I really need help to post back to PlayFab. In the Data Explorer I see the auth_token_validated which means that it register click on the link.

I know that this is not a php forum but I take a chance to post this request here as it is the PlayFab forum and this is related. I have been searching for examples and that is what this code is based on. The following is an extract of the full script:


// Perform the POST request to PlayFab


            $url = "https://titleId.playfabapi.com/Admin/ResetPassword";


            $data = array('Password' => $pw1, 'Token' => $link);


            $options = array(
                'http' => array(
                    'header'  => "X-SecretKey: xxxxxxxxxxxxxx",
                    'method'  => 'POST',
                    'content' => http_build_query($data)
                )
            );


            $context  = stream_context_create($options);
            $resp = file_get_contents($url, false, $context);
            var_dump($resp);
apisPlayer Data
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image
Seth Du answered

Use raw HTTP calls to access PlayFab is feasible since PlayFab is a service based on RESTful API, however, it is highly recommended to import our SDK to reduce your development difficulties. Please refer to PHP quickstart - PlayFab | Microsoft Docs and PHP SDK - PlayFab | Microsoft Docs to implement PHP SDK.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

peterkallviks avatar image
peterkallviks answered

@SethDu Can you please remove my answer thank you. I will rewrite the answer as soon as you removed it.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

I have removed your previous answer.

0 Likes 0 ·
peterkallviks avatar image
peterkallviks answered

Tx by mistake I missed to delete my secret key :-)

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

peterkallviks avatar image peterkallviks commented ·

I did finally got this to work in Postman:

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: xxxxxxxxxxxxxx',
                'Content-Type: application/json\\'
            ),
        ));


        $response = curl_exec($curl);


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


        echo '<br>========== END ==========';

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.