2015-11-01 44 views
0

我正在使用Infusionsoft SDK。我试图进行一些API调用时遇到了障碍。我有一个对象,但错误表示我正在对一个非对象进行函数调用

我发出的任何呼叫都以相同的Call to a member function getRefreshToken() on a non-object错误结束(但并非总是getRefreshToken())。

当我var_dump,我看到它是一个对象..所以,什么给?

object(Infusionsoft\Infusionsoft)#182 (13) { ["url":protected]=> string(42) "https://api.infusionsoft.com/crm/xmlrpc/v1" ["auth":protected]=> string(51) "https://signin.infusionsoft.com/app/oauth/authorize" ["tokenUri":protected]=> string(34) "https://api.infusionsoft.com/token" ["clientId":protected]=> string(24) "actual client ID" ["clientSecret":protected]=> string(10) "actual secret key" ["redirectUri":protected]=> string(65) "http://benjamin_redden.dev/wp-content/plugins/ajaxIsForm/auth.php" ["apis":protected]=> array(0) { } ["debug":protected]=> bool(false) ["httpClient":protected]=> NULL ["httpLogAdapter":protected]=> NULL ["serializer":protected]=> NULL ["needsEmptyKey"]=> bool(true) ["token":protected]=> string(24) "actual token" } Fatal error: Call to a member function getRefreshToken() on a non-object in /Users/Krsna/Sites/benjamin_redden/wp-content/plugins/ajaxIsForm/vendor/infusionsoft/php-sdk/src/Infusionsoft/Infusionsoft.php on line 261

那就是我从运行的调用,比如得到错误...

var_dump($infusionsoft); $infusionsoft->refreshAccessToken();

function get_those_ids($infusionsoft){ 
    var_dump($infusionsoft); 
    // get the form IDS 
    $formIDS = $infusionsoft->webForms()->getMap(); 

    // make the dropdown 
    echo '<select name="infusionsoft_forms_which_form_would_you_like_to_use_" id="infusionsoft_forms_which_form_would_you_like_to_use_">'; 
    foreach($formIDS as $formID => $formName){ 
    echo '<option value="'. $formID .'">'. $formName .'</option>'; 
    } 
    echo '</select>'; 
} 

回答

0

想通了!

我设置的令牌包含令牌的实际字符串,但显然它宁愿让整个对象令牌(包含刷新令牌,重定向URI,生命的尽头,一切都)

所以,它结束了类似$infusionsoft->setToken($unserializedToken);

,而不是像$infusionsoft->setToken($tokenString);

这伟大的工作,直到我试图保存一些信息到自定义后类型WP,现在我得到的是狂饮错误... = (

相关问题