question

Xiumo avatar image
Xiumo asked

php SDK not working

Has anyone used php sdk. I can't seem to run through this sdk. I don't know if it's my problem or php sdk has a problem. Has bothered me for a long time.

If i use 9810c as titleID, will get an error:cUrl Error: Could not resolve host: 9810c

test.png (88.1 KiB)
test2.png (57.9 KiB)
7 comments
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 haven't fully tested it but for login related PlayFab API. The property TitleId is required in the request. Please add it to the request body and give it another try. Feel free to tell us if there are still any other issues.

0 Likes 0 ·
Xiumo avatar image Xiumo Seth Du ♦ commented ·
I just need to be able to log in, but still not. follow the php sdk guide, not get right result.
0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Xiumo commented ·

Also, I believe the TitleId field (the first field) should be filled with an ID instead of an endpoint.

0 Likes 0 ·
Show more comments
Xiumo avatar image Xiumo commented ·

hello, any update?

0 Likes 0 ·
Seth Du avatar image
Seth Du answered

Here is full fix reported by the team. Please fix the following code:

if ($authValue) $result = $methodReflection->invoke(null, $TitleId, $authValue, $JsonRequest); else $result = $methodReflection->invoke(null, $TitleId, $JsonRequest);
        public static function GetFullUrl($titleId, $apiPath, $getParams)
        {
            if (!isset($titleId) && isset(PlayFabSettings::$titleId))
                $titleId = PlayFabSettings::$titleId;

            $output = "";
            if (!(substr(self::$productionEnvironmentUrl, 0, 4) === "http")) {
                if (isset(self::$verticalName)) {
                    $output = "https://" . self::$verticalName;
                } else {
                    $output = "https://" . $titleId;
                }
            }

            $output .= self::$productionEnvironmentUrl;
            $output .= $apiPath;
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

I have added a reply but it seems to be deleted somehow.

We are trying to reproduce your issue and here is something we have done. Please check the PlayFabHttp.php file in PlayFab SDK folder:

Around line 20:

if (!(substr($productionEnvironmentUrl, 0, 4) === "http"))

Replace it with:

if (!(substr(self::$productionEnvironmentUrl, 0, 4) === "http"))

Another place that refers $productionEnvironmentUrl is around line 32:

$output .= $productionEnvironmentUrl;

Replace it with:

$output .= self::$productionEnvironmentUrl;

Also, please keep the TitleID field filled with ID only, like "9810C", because I have noticed that SDK will concatenate it with other strings to be an endpoint URL. In addition, there is no need to add a "TitleId" property in the request since the SDK will check and add it automatically.

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 ·

To be honest, I am not expert on php, there is a place that I don't fully understand, which is located at login related function in PlayFabClientApi.php. for example, in line 1090, function LoginWithCustomID:

if (!isset($request->$titleId)) !$request->titleId = $titleId;

I believe what it wants to do is to add TitleID property if the request doesn't contain one. If there is no other issues can be found, you may try to modify this line.

Moreover, Could you please output the $fullUrl in function MakeCurlApiCall of PlayFabHttp class, which is also located in PlayFabHttp.php?

0 Likes 0 ·

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.