Php Quickbook online service gives 500 internal server

Php Quickbook online service gives 500 internal server,php,curl,quickbooks,quickbooks-online,Php,Curl,Quickbooks,Quickbooks Online,I am trying to call service via curl and here is my code and every time I got the attached error error_reporting(-1); $qbsite = ""; $headers = array( 'Content-Type'=>'application/xml', 'oauth_version' => "1.0", 'oauth_signature_method'=>"HMAC-SHA1", 'oauth_nonce'=>"xxx", 'oauth_timestamp'=>"xxx", 'oauth_consumer_key'=>"qyprdvZraQrBVbrPIptwd6gl6C6knP", 'oauth_t

I am trying to call service via curl and here is my code and every time I got the attached error

$qbsite = "";
$headers = array(
        'oauth_version' => "1.0",


$xmlData = '<?xml version="1.0" encoding="utf-16"?> 
            <Account xmlns:ns2="" xmlns=""> 
                <Name>Loan Account </Name> 
                <Desc>Loan Account</Desc> 

$ch = curl_init($qbsite);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, "\n{$xmlData}");
$response = curl_exec($ch);
print($response);die; !

enter image description here



$headers = array(
        'oauth_version' => "1.0",


Is not even close to a correct OAuth signature. OAuth signatures place all of that information in a single Authorization: ... HTTP header, whereas you've slapped each piece of OAuth data in a separate HTTP header.

For example, a correct OAuth header looks something like this:

Authorization: OAuth realm="",

Additionally, OAuth signatures are not static values - they must be calculated and they change with EVERY request.

You should download the nightly build of the QuickBooks PHP DevKit (disclaimer: I'm the author) - it's a library that is specifically designed to do exactly what you're doing (integrate with QuickBooks), and it takes care of building the correct OAuth requests for you.

Specifically, download it and look at these examples:

  • docs/example_ipp_oauth.php
  • docs/example_ipp_ids_5.php


Have you tried removing the , at the end of this line



yes it works but when I am using example_ipp_ids_1.php and added certain data (token,uname and password etc. correctly) $list = $CustomerService->findAll($Context, $realmID); returns emty object while in the QBO I have total 12 customers. any suggestion? or may be because it is nightly build?


docs/example_ipp_ids_1.php is not set up to use OAuth. So unless you swap out all of the initialization stuff at the top of docs/example_ipp_ids_1.php for the OAuth setup stuff, it's not going to work. If you compare the code between the two examples it should be pretty obvious what you need to change.


yes keith I understand that but I just want to fetch all customer list from QBO is there any way to fetch this data....


@RajatModi Yes, there is. You can use similar code to what is shown in docs/example_ipp_ids_1.php, but instead of using $IPP->authenticate(), use $IPP->authMode(QuickBooks_IPP::AUTHMODE_OAUTH, ...) like shown in the other examples I've already mentioned.


yes keith it works like charm thanks mate you are great :) awesome work from you...


yeah but it didn't work :( I am daze with the curl url is it correct? and yes thanks for your quick replay