gpt4 book ai didi

PHP:调用 Google Play Developer API 中未定义的方法

转载 作者:搜寻专家 更新时间:2023-10-31 21:24:36 36 4
gpt4 key购买 nike

我将通过其 PHP 客户端从远程服务器使用 google API 获取我的应用内产品列表。

这是我的代码:

$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setRedirectUri($redirect_uri);
$client->addScope("https://www.googleapis.com/auth/androidpublisher");

$service = new Google_Service_AndroidPublisher($client);
$optParams = array('token' => 'my token....');
$results = $service->inappproducts->list ('my.package.name', $optParams);

当我运行这段代码时,出现以下错误: fatal error :调用未定义的方法 Google_Service_AndroidPublisher_Inappproducts_Resource::list()

我根据 api reference 中列出的一些示例和详细信息实现了我的代码.我刚刚带来了 $service->inappproducts 的 var_dump 供您引用:

object(Google_Service_AndroidPublisher_Inappproducts_Resource)#14 (7) { ["stackParameters":"Google_Service_Resource":private]=> array(10) { ["alt"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["fields"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["trace"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["userIp"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["quotaUser"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["data"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(4) "body" } ["mimeType"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(6) "header" } ["uploadType"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["mediaUpload"]=> array(2) { ["type"]=> string(7) "complex" ["location"]=> string(5) "query" } ["prettyPrint"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } } ["rootUrl":"Google_Service_Resource":private]=> string(27) "https://www.googleapis.com/" ["client":"Google_Service_Resource":private]=> object(Google_Client)#1 (9) { ["auth":"Google_Client":private]=> NULL ["io":"Google_Client":private]=> NULL ["cache":"Google_Client":private]=> NULL ["config":"Google_Client":private]=> object(Google_Config)#2 (1) { ["configuration":protected]=> array(7) { ["application_name"]=> string(0) "" ["auth_class"]=> string(18) "Google_Auth_OAuth2" ["io_class"]=> string(14) "Google_IO_Curl" ["cache_class"]=> string(17) "Google_Cache_File" ["logger_class"]=> string(18) "Google_Logger_Null" ["base_path"]=> string(26) "https://www.googleapis.com" ["classes"]=> array(10) { ["Google_IO_Abstract"]=> array(1) { ["request_timeout_seconds"]=> int(100) } ["Google_IO_Curl"]=> array(2) { ["disable_proxy_workaround"]=> bool(false) ["options"]=> NULL } ["Google_Logger_Abstract"]=> array(4) { ["level"]=> string(5) "debug" ["log_format"]=> string(42) "[%datetime%] %level%: %message% %context% " ["date_format"]=> string(13) "d/M/Y:H:i:s O" ["allow_newlines"]=> bool(true) } ["Google_Logger_File"]=> array(3) { ["file"]=> string(12) "php://stdout" ["mode"]=> int(416) ["lock"]=> bool(false) } ["Google_Http_Request"]=> array(2) { ["disable_gzip"]=> bool(false) ["enable_gzip_for_uploads"]=> bool(false) } ["Google_Auth_OAuth2"]=> array(13) { ["client_id"]=> string(71) "" ["client_secret"]=> string(24) "" ["redirect_uri"]=> string(42) "https://android-e1test.rhcloud.com/verify/" ["developer_key"]=> string(0) "" ["hd"]=> string(0) "" ["prompt"]=> string(0) "" ["openid.realm"]=> string(0) "" ["include_granted_scopes"]=> string(0) "" ["login_hint"]=> string(0) "" ["request_visible_actions"]=> string(0) "" ["access_type"]=> string(6) "online" ["approval_prompt"]=> string(4) "auto" ["federated_signon_certs_url"]=> string(42) "https://www.googleapis.com/oauth2/v1/certs" } ["Google_Task_Runner"]=> array(5) { ["initial_delay"]=> int(1) ["max_delay"]=> int(60) ["factor"]=> int(2) ["jitter"]=> float(0.5) ["retries"]=> int(0) } ["Google_Service_Exception"]=> array(1) { ["retry_map"]=> array(4) { [500]=> int(-1) [503]=> int(-1) ["rateLimitExceeded"]=> int(-1) ["userRateLimitExceeded"]=> int(-1) } } ["Google_IO_Exception"]=> array(1) { ["retry_map"]=> array(5) { [6]=> int(-1) [7]=> int(-1) [28]=> int(-1) [35]=> int(-1) [52]=> int(-1) } } ["Google_Cache_File"]=> array(1) { ["directory"]=> string(18) "/tmp/Google_Client" } } } } ["logger":"Google_Client":private]=> NULL ["deferExecution":"Google_Client":private]=> bool(false) ["requestedScopes":protected]=> array(1) { [0]=> string(48) "https://www.googleapis.com/auth/androidpublisher" } ["services":protected]=> array(0) { } ["authenticated":"Google_Client":private]=> bool(false) } ["serviceName":"Google_Service_Resource":private]=> string(16) "androidpublisher" ["servicePath":"Google_Service_Resource":private]=> string(33) "androidpublisher/v2/applications/" ["resourceName":"Google_Service_Resource":private]=> string(13) "inappproducts" ["methods":"Google_Service_Resource":private]=> array(7) { ["batch"]=> array(3) { ["path"]=> string(19) "inappproducts/batch" ["httpMethod"]=> string(4) "POST" ["parameters"]=> array(0) { } } ["delete"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(6) "DELETE" ["parameters"]=> array(2) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } } } ["get"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(3) "GET" ["parameters"]=> array(2) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } } } ["insert"]=> array(3) { ["path"]=> string(27) "{packageName}/inappproducts" ["httpMethod"]=> string(4) "POST" ["parameters"]=> array(2) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["autoConvertMissingPrices"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "boolean" } } } ["list"]=> array(3) { ["path"]=> string(27) "{packageName}/inappproducts" ["httpMethod"]=> string(3) "GET" ["parameters"]=> array(4) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["maxResults"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "integer" } ["startIndex"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "integer" } ["token"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(6) "string" } } } ["patch"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(5) "PATCH" ["parameters"]=> array(3) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["autoConvertMissingPrices"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "boolean" } } } ["update"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(3) "PUT" ["parameters"]=> array(3) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["autoConvertMissingPrices"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "boolean" } } } } } 

最佳答案

我在这里从臀部射击,但试试这个:

$results = $service->inappproducts->listInappproducts('my.package.name', $optParams);

代替:

$results = $service->inappproducts->list ('my.package.name', $optParams);

正如我评论的那样,您应该更改您的客户端密码,因为它看起来像您在您的 var_dump 中发布的那样。

关于PHP:调用 Google Play Developer API 中未定义的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39063348/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com