【问题标题】:Unable to run QuickBooks Online PHP DevKit on IIS无法在 IIS 上运行 QuickBooks Online PHP DevKit
【发布时间】:2017-07-19 10:23:54
【问题描述】:

我已经通过本地 IIS 服务器上的 git 克隆了 QuickBooks PHP DevKit

并按照此处提到的步骤更新了\docs\partner_platform\example_app_ipp_v3\config.php 文件中的一些变量:QuickBooks ONLINE Quick Start

$token = '505851e5b393db43d5b8fd6b5c67cc3584c0';

$oauth_consumer_key = 'qyprdc1Q7grOuaQzN8Y3fxq6RxRfsI';
$oauth_consumer_secret = 'o4JTZVLndeBpp5iqFNj19ysJf0NW0t9QCAh6iIJ6';

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

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

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

$dsn = 'mysqli://root:sa123@192.168.1.3:3306/test'; // same connection works for another application

此示例适用于 Mac 上的 Apache 服务器。但它在 Windows 上给出了这个错误:http://prnt.sc/eccdc3

当我尝试将工作代码从 Apache(Mac) 运行到 IIS (Windows) 时,它也会出现一些奇怪的错误,这在 Stack Overflow 问题的第 3 期中提到:Unable to add TaxRate, get multiple ShipAddr from/to QuickBooks Online using QuickBooks PHP DevKit

【问题讨论】:

  • 发布您的代码。在 Intuit 的开发人员控制面板中发布键/配置的屏幕截图。如果没有这些细节,我们将无法为您提供帮助。
  • 完整代码与从 QuickBooks PHP DevKit 的 Github 下载的一样,..\example_app_ipp_v3\config.php 文件除外。我已经用上述值更改了 config.php 变量。我是从 Intuit 开发者门户网站获得的:ibb.co/f6tgov 如果我在 Apache 服务器上托管 Devkit 示例,那么同样的密钥也可以工作。我也应该上传修改后的 config.php 文件吗?谢谢@KeithPalmerJr。
  • 在 Intuit 的开发者控制面板中发布按键/配置的屏幕截图。
  • 图片链接已损坏...
  • @KeithPalmerJr。对不起。代码链接:drive.google.com/open?id=0B58SHwK_1xk9Z3BQV2tyd0pCSTg Intuit 开发人员密钥截图链接:drive.google.com/open?id=0B58SHwK_1xk9blltVTVCZWY1NVU P.S.代码可能在其他 Web 服务器上运行,但它在 IIS (Windows) 上给出了上述错误。您可以在此处查看此示例:internetofapp.com/quickbooks-php/docs/partner_platform/…

标签: php quickbooks quickbooks-online


【解决方案1】:

您的 cURL PHP 扩展似乎配置错​​误。如果您注意到,当您尝试使用 cURL 访问 TLS/SSL 网站时,您会得到如下内容:

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

   Did we disable SSL checks? false
* Hostname oauth.intuit.com was found in DNS cache
*   Trying 173.240.170.25...
* TCP_NODELAY set
* Connected to oauth.intuit.com (173.240.170.25) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* SSL certificate problem: self signed certificate in certificate chain
* Curl_http_done: called premature == 1
* Closing connection 0

请注意,在交换任何实际数据之前,连接会立即关闭。

将其与显式禁用 TLS/SSL 验证时的结果进行比较:

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

   Did we disable SSL checks? true
* Hostname oauth.intuit.com was found in DNS cache
*   Trying 173.240.170.25...
* TCP_NODELAY set
* Connected to oauth.intuit.com (173.240.170.25) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* SSL connection using TLSv1.2 / AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=California; L=San Diego; O=INTUIT INC.; OU=CTO-DEV-ICS-OAuth1; CN=oauth.intuit.net
*  start date: Sep  9 00:00:00 2016 GMT
*  expire date: Sep 10 23:59:59 2019 GMT
*  issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
*  SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
> GET /oauth/v1/get_request_token HTTP/1.1
Host: oauth.intuit.com
Accept: */*

< HTTP/1.1 400 Bad Request
< Content-Type: text/plain
< Content-Length: 70
< Connection: keep-alive
< Date: Tue, 28 Mar 2017 02:34:14 GMT
< Server: Apache
< WWW-Authenticate: OAuth oauth_parameters_absent="oauth_signature", oauth_problem="parameter_absent"
< Cache-Control: no-cache, no-store
< Pragma: no-cache
< 
* Curl_http_done: called premature == 0
* Connection #0 to host oauth.intuit.com left intact


oauth_problem=parameter_absent&oauth_parameters_absent=oauth_signature

请注意,它现在可以工作了。

这告诉我,这里可能的问题是您的 cURL PHP 扩展不知道如何发出 TLS 请求。这是 cURL 和 PHP 的一个常见问题。

如果您在 Google 或 StackOverflow 上搜索类似的内容:

  • “PHP cURL 不适用于 HTTPS”

您会在此处找到许多解释如何处理此问题的答案,以及有关信任库和 CA 的官方 cURL 声明:

还请查看并确认此 PHP cURL 配置变量的正确配置:

  • curl.cainfo

参考这个:

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多