2017-02-28 69 views
0

我通過本地IIS服務器上的git克隆了QuickBooks PHP DevKit無法在IIS上運行QuickBooks Online 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:[email protected]:3306/test'; // same connection works for another application 

此示例工程Apache服務器上的Mac。但它給在Windows此錯誤:http://prnt.sc/eccdc3

這也給了我嘗試運行Apache的(Mac)來IIS(Windows)中的工作代碼,在這個堆棧溢出問題的問題#3提到了一些奇怪的錯誤:Unable to add TaxRate, get multiple ShipAddr from/to QuickBooks Online using QuickBooks PHP DevKit

+0

發表您的碼。在Intuit的開發人員控制面板中發佈按鍵/配置的屏幕截圖。沒有這些細節,我們無法幫助你。 –

+0

完整的代碼就像從QuickBooks PHP DevKit的Github下載,除了'.. \ example_app_ipp_v3 \ config.php'文件。我已經用上面的值改變了config.php變量。我從Intuit開發人員門戶網站獲得了這個:https://ibb.co/f6tgov如果我在Apache服務器上託管Devkit示例,這個相同的密鑰可以工作。 我應該上傳修改過的config.php文件嗎?謝謝@KeithPalmerJr。 –

+0

在Intuit的開發人員控制面板中發佈按鍵/配置的屏幕截圖。 –

回答

1

您的cURL PHP擴展似乎配置錯​​誤。如果您發現,當您嘗試使用捲曲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的一個常見問題。

如果你搜索谷歌或StackOverflow的這樣的事情:

「PHP捲曲不使用HTTPS工作」你會發現很多的答案,說明如何處理這個的,沿有關此信任存儲中科院官方捲曲聲明:

也請看看,並確認該PHP捲曲配置變量的正確配置:

  • curl.cainfo

參考這樣的:

+0

感謝Keith。你的建議是準確的。此鏈接幫助我解決了這個問題:https://github.com/ably/ably-php/issues/32 –