0

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

Community
  • 1
  • 1
Ketan Modi
  • 1,780
  • 1
  • 16
  • 28
  • Post your code. Post a screenshot of the keys/configuration in Intuit's developer control panel. Without those details, we can not help you. – Keith Palmer Jr. Feb 28 '17 at 12:44
  • Full code is as is as downloaded from Github of QuickBooks PHP DevKit except `..\example_app_ipp_v3\config.php` file. I've changed config.php variables with above values. I got this from Intuit Developer portal: https://ibb.co/f6tgov This same keys works, if I host Devkit sample on Apache server. Should I upload modified config.php file too? Thank you @KeithPalmerJr. – Ketan Modi Feb 28 '17 at 16:36
  • Post a screenshot of the keys/configuration in Intuit's developer control panel. – Keith Palmer Jr. Feb 28 '17 at 17:49
  • Link to picture is broken... – Keith Palmer Jr. Feb 28 '17 at 20:36
  • @KeithPalmerJr. Sorry. Link to Code: https://drive.google.com/open?id=0B58SHwK_1xk9Z3BQV2tyd0pCSTg Link to Screenshot of Intuit Developer Keys: https://drive.google.com/open?id=0B58SHwK_1xk9blltVTVCZWY1NVU P.S. Code may work on other Web Servers but it's giving said error on IIS (Windows). You can view this sample running here: http://internetofapp.com/quickbooks-php/docs/partner_platform/example_app_ipp_v3/ – Ketan Modi Mar 01 '17 at 03:40
  • Do you have the PHP mcrypt extension enabled? How about the curl extension enabled? – Keith Palmer Jr. Mar 01 '17 at 05:41
  • @KeithPalmerJr. Both are enabled. http://internetofapp.com/quickbooks-php/docs/partner_platform/example_app_ipp_v3/phpinfo.php Check this phpinfo() and at bottom, I've checked function exists for `mcrypt_encrypt` and `curl_version`. – Ketan Modi Mar 01 '17 at 06:12
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/136929/discussion-between-ronak-and-keith-palmer-jr). – Ketan Modi Mar 01 '17 at 07:36
  • I just checked in a 'troubleshooting.php' script to the repo. Can you git pull that and post the output of that file? – Keith Palmer Jr. Mar 23 '17 at 11:34
  • Sorry for delay. I'm not getting notification. Here you go http://internetofapp.com/quickbooks-php/docs/partner_platform/example_app_ipp_v3/troubleshooting.php – Ketan Modi Mar 25 '17 at 18:35
  • I've modified output buffer logic to make it work on Windows (in different file). http://internetofapp.com/quickbooks-php/docs/partner_platform/example_app_ipp_v3/troubleshooting2.php – Ketan Modi Mar 26 '17 at 05:05

1 Answers1

1

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:

Keith Palmer Jr.
  • 27,666
  • 16
  • 68
  • 105
  • Thanks Keith. Your suggestion was accurate. This link helped me fix the issue: https://github.com/ably/ably-php/issues/32 – Ketan Modi Mar 29 '17 at 09:48