我想从我的默认沙箱QB应用中获取报告。我已成功登录并拥有令牌等所有数据。现在我如何使用以下URL中提到的v3-php-sdk-2.1.0发送GET请求报告?
我想从我的默认沙箱QB应用中获取报告。我怎样才能使用v3-php-sdk-2.1.0发送GET请求报告?
关注此/ / 23232279 / php-sdk-v3-reporting-issues
我现在尝试使用以下请求标头获取简单帐户(这看起来与此处相同:开发人员(。)直觉(。)com / v2 / apiexplorer?apiname = V3QBO#?id =读取电话下的帐户)
[ “headers_sent”] => string(657)“GET / v3 / company / 1421610450 / account / 12 HTTP / 1.1 host:sandbox-quickbooks.api.intuit.com user-agent:V3PHPSDK2.1 accept:application / json connection:close content-type:application / json授权:OAuth oauth_consumer_key =“xxxxx”,oauth_signature_method =“HMAC-SHA1”,oauth_nonce =“xxxxx”,oauth_timestamp =“1440907935”,oauth_version =“1.0”,oauth_token =“a:2:{s:18:” oauth_token_secret “; S:40:” XXXXX “; S:11:” 组oauth_token “; S:48:” XXXXX “;}”,oauth_signature = “XXXXX”“
oauth收到的身体是
[ “body_recv”] => string(675)“message = BadRequest; errorCode = 003202; statusCode = 400无效的uri'https://oauth.intuit.net/iam/oauth_utils/v1/consumers/qyprdgehPU17WVK6BTQ54kVDfYRLFP/access_tokens/a:2:{s:18:”oauth_token_secret“; s:40:”xxxxxxxxx“; s:11:”oauth_token“; s:48:“xxxxxxxxx”;}':转义绝对路径无效“:转义绝对路径无效”
这是我的sdk.config(我从我自己的配置文件中获取密钥和秘密,这就是为什么不在其中设置)
<ipp>
<security mode="OAuth">
<oauth consumerKey="" consumerToken="" accessKey="" accessToken="" />
</security>
<message>
<request serializationFormat="Xml" compressionFormat="None"/>
<response serializationFormat="Xml" compressionFormat="None"/>
</message>
<service>
https://sandbox-quickbooks.api.intuit.com/" qbo="https://sandbox-quickbooks.api.intuit.com/" ipp="https://appcenter.intuit.com/api/" />
</service>
<logger>
<requestLog enableRequestResponseLogging="true" requestResponseLoggingDirectory="/IdsLogs" />
</logger>
<!--
Available strategies are file, handler and export.
file - saves response into temporary file in system temp folder.
The file should be removed manually
handler - saves response into temporary file and provides file handler.
The file is automatically removed after script termination or when developer closes the handler
export - saves response into export folder. Additional parameter "exportDirectory" should be specified
<contentWriter strategy="export" exportDirectory="/path/to/target/folder">
For advance usage you can specify returnObject="true" to work with instance of contentWriter
-->
<contentWriter strategy="file" prefix="ipp"/>
<specialConfiguration>
<TaxService jsonOnly="true"/>
</specialConfiguration>
<minorVersion>2</minorVersion>
</ipp>
<!--Intuit Anywhere QBD-->
<!--Specify AccessToken Value for QBD-->
<add key="AccessTokenQBD" value="" />
<!--Specify accessTokenSecret Value for QBD-->
<add key="AccessTokenSecretQBD" value="" />
<!--Specify consumerKey Value for QBD-->
<add key="ConsumerKeyQBD" value="" />
<!--Specify consumerSecret Value for QBD-->
<add key="ConsumerSecretQBD" value="" />
<!--Specify realmIdIA Value for QBD-->
<add key="RealmIAQBD" value="" />
<!--Intuit Anywhere QBO-->
<!--Specify AccessToken Value for QBO-->
<add key="AccessTokenQBO" value="" />
<!--Specify accessTokenSecret Value for QBO-->
<add key="AccessTokenSecretQBO" value="" />
<!--Specify consumerKey Value for QBO-->
<add key="ConsumerKeyQBO" value="" />
<!--Specify consumerSecret Value for QBO-->
<add key="ConsumerSecretQBO" value="" />
<!--Specify realmIdIA Value for QBO-->
<add key="RealmIAQBO" value="" />
虽然config.php在v3-php-sdk-2.1.0中保持不变(注意我也使用v3-php-sdk-2.0.5检查了它但结果相同)
任何帮助将不胜感激。提前谢谢。
答案 0 :(得分:0)
这是因为您的示例oauth代码通过序列化accessToken
来保存令牌$ access_token = $ oauth-&gt; getAccessToken($ this-&gt; CI-&gt; config-&gt; item(&#39; OAUTH_ACCESS_URL&#39;),&#39;&#39;,$ this- &gt; CI-&gt; input-&gt; get(&#39; oauth_verifier&#39;)); $ this-&gt; CI-&gt; session-&gt; set_userdata(&#39;令牌&#39;,序列化($ access_token));
我们需要像下面这样进行进一步的通话
$ token = unserialize($ this-&gt; CI-&gt; session-&gt; userdata(&#39; token&#39;));
$ requestValidator =新的OAuthRequestValidator($ token [&#34; oauth_token&#34;],$ token [&#34; oauth_token_secret&#34;],
$ this-&gt; CI-&gt; config-&gt; item(&#39; OAUTH_CONSUMER_KEY&#39;),$ this-&gt; CI-&gt; config-&gt; item(&#39; OAUTH_CONSUMER_SECRET&#39;)) ;
此代码特定于codeigniter Library