【问题标题】:Message: Error getting application from request token消息:从请求令牌获取应用程序时出错
【发布时间】:2017-08-14 21:26:56
【问题描述】:

我试图将 QuickBooks Online 与 PHP 连接起来。我正在使用 Xampp 服务器 Windows 操作系统。

我遵循了 conolibyte 的 API。我下载了 Quickbooks-PHP-Master 存储库并对 config.php 文件进行了更改。

我有一个关于 Intuit Development 的应用程序,并且有 3 个密钥。

当我运行 index.php 页面时,一切正常。

但是当我点击“连接到 quickbooks”按钮时。出现错误:

错误代码:internal_error 消息:从请求令牌获取应用程序时出错

error_reporting(E_ALL);
ini_set('display_errors', 1);

// Require the library code
require_once dirname(__FILE__) . '/../../../QuickBooks.php';

$token = '76ac0cdabc168b42c2bb997bba4ef0beb2c0';

$oauth_consumer_key = 'qyprdkDO0aY2NHrrk9xx6JZB3xbrIB';
$oauth_consumer_secret = 'eqcBAjc8SnOpVsz49Nf6H5ms58Ns2Up4PJPAe8o5';

 $sandbox = true; 

 $quickbooks_oauth_url = 'http://localhost:81/quickbooks-php-   master/docs/partner_platform/example_app_ipp_v3/oauth.php';

 $quickbooks_success_url = 'http://localhost:81/quickbooks-php-master/docs/partner_platform/example_app_ipp_v3/success.php';


 $quickbooks_menu_url = 'http://localhost:81/quickbooks-php-master/docs/partner_platform/example_app_ipp_v3/menu.php';

 $dsn = 'mysqli://root:@localhost/test';

  $encryption_key = 'bcde1234';

  $the_username = 'DO_NOT_CHANGE_ME';

   $the_tenant = 12345;

   if (!QuickBooks_Utilities::initialized($dsn))

     {

    QuickBooks_Utilities::initialize($dsn);
     }

   $IntuitAnywhere = new QuickBooks_IPP_IntuitAnywhere($dsn,            $encryption_key, $oauth_consumer_key, $oauth_consumer_secret,          $quickbooks_oauth_url, $quickbooks_success_url);


   if ($IntuitAnywhere->check($the_username, $the_tenant) and 

    $IntuitAnywhere->test($the_username, $the_tenant))

    {

     $quickbooks_is_connected = true;


     $IPP = new QuickBooks_IPP($dsn);


       $creds = $IntuitAnywhere->load($the_username, $the_tenant);


      $IPP->authMode(
        QuickBooks_IPP::AUTHMODE_OAUTH, 
      $the_username, 
       $creds);

       if ($sandbox)
        {

       $IPP->sandbox(true);
       }

        $realm = $creds['qb_realm'];


       $Context = $IPP->context();

        $CompanyInfoService = new QuickBooks_IPP_Service_CompanyInfo();
      $quickbooks_CompanyInfo = $CompanyInfoService->get($Context, $realm);
       }
       else
        {

        $quickbooks_is_connected = false;
        }

请提供任何解决方案。

Error Message image

Keys image

froubleshooting.php 文件的响应

  Trying to hit URL: https://oauth.intuit.com/oauth/v1/get_request_token

     Did we disable SSL checks? false
    <br />
       <b>Warning</b>:  curl_setopt(): cannot represent a stream of type          Output as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />


     Trying to hit URL:    https://appcenter.intuit.com/api/v1/Connection/Reconnect

      Did we disable SSL checks? false
    <br />
     <b>Warning</b>:  curl_setopt(): cannot represent a stream of type Output     as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />

       Trying to hit URL: https://oauth.intuit.com/oauth/v1/get_request_token

         Did we disable SSL checks? true
        <br />
         <b>Warning</b>:  curl_setopt(): cannot represent a stream of type  Output as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php-  master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line    <b>30</b><br />

      oauth_problem=parameter_absent&oauth_parameters_absent=oauth_signature

       Trying to hit URL: https://appcenter.intuit.com/api/v1/Connection/Reconnect

        Did we disable SSL checks? true
         <br />
           <b>Warning</b>:  curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\xampp\htdocs\quickbook2\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />

          <?xml version="1.0" encoding="utf-8"?>
          <PlatformResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema"           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xmlns="http://platform.intuit.com/api/v1">
           <ErrorMessage>Authentication required</ErrorMessage>
          <ErrorCode>22</ErrorCode>
          <ServerTime>2017-03-23T13:08:09.853153Z</ServerTime>
          </PlatformResponse>


         php version: 5.6.30
         mcrypt extension? true
         mcrypt module rijndael-256? NULL
         curl extension? true

【问题讨论】:

  • 发布您的代码。在 Intuit 的网站上发布您的沙盒凭据的屏幕截图。检查以确保您有 curl 和 mcrypt 扩展。检查以确保您使用的是沙盒凭据,您已将 $sandbox 设置为 TRUE。
  • 你好,基思。感谢您的答复。我所做的是用错误消息和按键图像编辑我的问题。我还添加了我的 config.php 文件代码。我在 quickbooks 上使用试用帐户。所以我的 quickbooks 帐户上没有分配一个真正的公司。我只是想先进行试用,而不是与真正的公司合作。如果您需要,我可以给您我的 Intuit 开发人员凭据。
  • 我刚刚签入了一个 'troubleshooting.php' 脚本到 repo。您可以 git pull 并发布该文件的输出吗?
  • 你好 Keith:我重新编辑了我原来的问题。我添加了 Troubleshooting.php 文件的响应。请在我的原始问题中查找 Troubleshooting.php 文件标题的响应。

标签: php integration quickbooks


【解决方案1】:

根据您在上面发布的内容,您的 PHP 安装似乎没有正确验证 SSL 证书。

试试这个:

将此行改为if (true):

将此行改为if (true):

再试一次。如果解决了它,那么您就知道您的 PHP 安装已损坏——它没有正确验证 SSL 证书。

然后您应该考虑修复您的 PHP 安装:

【讨论】:

  • 非常感谢基思。上面两行代码已经解决了这个问题。它现在已连接。我现在可以运行各种查询。我还希望来自 quickbooks 的数据能够保存在 MySQL 中。有没有办法在 mysqli 中为客户、供应商等创建数据表...
  • 是的。谷歌“如何用 php 和 mysql 创建表”
猜你喜欢
  • 1970-01-01
  • 2015-09-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-26
  • 2011-10-25
  • 2019-01-27
  • 2017-03-05
相关资源
最近更新 更多