drbhjey445647
drbhjey445647
2017-02-28 12:34
浏览 63
已采纳

无法在IIS上运行QuickBooks Online PHP DevKit

I've cloned QuickBooks PHP DevKit via git on local IIS server.

And updated few variables in \docs\partner_platform\example_app_ipp_v3\config.php file as per the steps mentioned here: 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

This sample works on Apache Server on Mac. But it give this error on Windows: http://prnt.sc/eccdc3

It also gives some weird error when I try running working code from Apache(Mac) to IIS (Windows) which is mentioned in Issue # 3 of this Stack Overflow Question: Unable to add TaxRate, get multiple ShipAddr from/to QuickBooks Online using QuickBooks PHP DevKit

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanlinzhen7235
    duanlinzhen7235 2017-03-28 02:38
    已采纳

    Your cURL PHP extension appears to be misconfigured. If you notice, when you try to access TLS/SSL websites using cURL, you get stuff like this:

    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
    

    Notice the connection is getting closed immediately, before any actual data is exchanged.

    Compare that to the result when TLS/SSL verification is explicitly disabled:

    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
    

    Notice that it now works.

    This tells me that the likely problem here is that your cURL PHP extension doesn't know how to make TLS requests. This is a somewhat common problem with cURL and PHP.

    If you search Google or StackOverflow for something like this:

    • "PHP cURL Not Working with HTTPS"

    You'll find lots of answers explaining how to deal with this, along with the official cURL statements about trust stores and CAs here:

    Please also look at and confirm the correct configuration of this PHP cURL configuration variable:

    • curl.cainfo

    Reference this:

    点赞 评论

相关推荐