我已在本地使用Web连接器将quickbook桌面与我的软件(在PHP中)集成在一起,但是如果我的软件已上传到服务器上,我可以这样做吗?

问题描述 投票:-2回答:1

下面是我的we_connector file.php,它已通过客户添加功能上传到服务器上

并且我的软件已上传到服务器上。我想添加在线URL,但是Web连接器显示错误“ QuickBooks Web Connector无法验证Web应用程序服务器证书。”。

error_reporting(E_ALL | E_STRICT);ini_set('display_errors',1);

if (function_exists('date_default_timezone_set'))
{
    // * MAKE SURE YOU SET THIS TO THE CORRECT TIMEZONE! *
    // List of valid timezones is here: http://us3.php.net/manual/en/timezones.php
    date_default_timezone_set('America/New_York');
}


// Require the framework
require_once '../../QuickBooks.php';

$user = 'quickbooks';
$pass = 'password';


$map = array(
    QUICKBOOKS_ADD_CUSTOMER => array( '_quickbooks_customer_add_request', '_quickbooks_customer_add_response' ),
    );

// This is entirely optional, use it to trigger actions when an error is returned by QuickBooks
$errmap = array(
    3070 => '_quickbooks_error_stringtoolong',              // Whenever a string is too long to fit in a field, call this function: _quickbooks_error_stringtolong()
    // 'CustomerAdd' => '_quickbooks_error_customeradd',    // Whenever an error occurs while trying to perform an 'AddCustomer' action, call this function: _quickbooks_error_customeradd()
    // '*' => '_quickbooks_error_catchall',                 // Using a key value of '*' will catch any errors which were not caught by another error handler
    // ... more error handlers here ...
    );

// An array of callback hooks
$hooks = array(
    // There are many hooks defined which allow you to run your own functions/methods when certain events happen within the framework
    // QuickBooks_WebConnector_Handlers::HOOK_LOGINSUCCESS => '_quickbooks_hook_loginsuccess',  // Run this function whenever a successful login occurs
    );

/*
function _quickbooks_hook_loginsuccess($requestID, $user, $hook, &$err, $hook_data, $callback_config)
{
    // Do something whenever a successful login occurs...
}
*/

// Logging level
//$log_level = QUICKBOOKS_LOG_NORMAL;
//$log_level = QUICKBOOKS_LOG_VERBOSE;
$log_level = QUICKBOOKS_LOG_DEBUG;              
//$log_level = QUICKBOOKS_LOG_DEVELOP;      // Use this level until you're sure everything works!!!

// What SOAP server you're using 
//$soapserver = QUICKBOOKS_SOAPSERVER_PHP;          // The PHP SOAP extension, see: www.php.net/soap
$soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN;        // A pure-PHP SOAP server (no PHP ext/soap extension required, also makes debugging easier)

$soap_options = array(      // See http://www.php.net/soap
    );

$handler_options = array(
    //'authenticate' => ' *** YOU DO NOT NEED TO PROVIDE THIS CONFIGURATION VARIABLE TO USE THE DEFAULT AUTHENTICATION METHOD FOR THE DRIVER YOU'RE USING (I.E.: MYSQL) *** '
    //'authenticate' => 'your_function_name_here', 
    //'authenticate' => array( 'YourClassName', 'YourStaticMethod' ),
    'deny_concurrent_logins' => false, 
    'deny_reallyfast_logins' => false, 
    );      // See the comments in the QuickBooks/Server/Handlers.php file

$driver_options = array(        // See the comments in the QuickBooks/Driver/<YOUR DRIVER HERE>.php file ( i.e. 'Mysql.php', etc. )
    //'max_log_history' => 1024,    // Limit the number of quickbooks_log entries to 1024
    //'max_queue_history' => 64,    // Limit the number of *successfully processed* quickbooks_queue entries to 64
    );

$callback_options = array(
    );



$dsn = 'mysqli://water_ways_user:zAEGQKI74YHyz6Do@localhost/water_ways';






if (!QuickBooks_Utilities::initialized($dsn))
{
    // Initialize creates the neccessary database schema for queueing up requests and logging
    QuickBooks_Utilities::initialize($dsn);

    // This creates a username and password which is used by the Web Connector to authenticate
    QuickBooks_Utilities::createUser($dsn, $user, $pass);


    $primary_key_of_your_customer = 5;

    $Queue = new QuickBooks_WebConnector_Queue($dsn);
    $Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $primary_key_of_your_customer,$priority);


}


$Server = new QuickBooks_WebConnector_Server($dsn, $map, $errmap, $hooks, $log_level, $soapserver, QUICKBOOKS_WSDL, $soap_options, $handler_options, $driver_options, $callback_options);
$response = $Server->handle(true, true);


function _quickbooks_customer_add_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{

$myHost = "localhost"; // use your real host name
$myUserName = "water_ways_user";   // use your real login user name
$myPassword = "zAEGQKI74YHyz6Do";   // use your real login password
$myDataBaseName = "water_ways"; // use your real database name

$con = mysqli_connect( "$myHost", "$myUserName", "$myPassword", "$myDataBaseName" );

if( !$con ) // == null if creation of connection object failed
{ 
    // report the error to the user, then exit program
    die("connection object not created: ".mysqli_error($con));
}

if( mysqli_connect_errno() )  // returns false if no error occurred
{ 
    // report the error to the user, then exit program
    die("Connect failed: ".mysqli_connect_errno()." : ". mysqli_connect_error());
}





    // Fetch your customer record from your database
    $name='';
    $company_name = '';
    $address1='';
    $address2 ='';
    $phone = '';
    $contact = '';
    $email = '';


    $row = mysqli_fetch_array(mysqli_query($con,"SELECT * FROM customer_info WHERE customer_info_id ='$ID'"));
     //$sql=mysqli_query($con,"SELECT * FROM customer_info WHERE customer_info_id ='3'");
     //if($row = mysqli_fetch_assoc($sql))
    // {

    // Create and return a qbXML request

    $name=$row['customer_name'];
    $company_name = $row['company_name'];
    $address1=$row['address_1'];
    $address2 =$row['address_2'];
    $phone = $row['phone_number'];
    $contact = $row['customer_name'];
    $email = $row['email'];

        $qbxml = '<?xml version="1.0" encoding="utf-8"?>
        <?qbxml version="2.0"?>
        <QBXML>
            <QBXMLMsgsRq onError="stopOnError">
                <CustomerAddRq requestID="'.$requestID.'">
                    <CustomerAdd>
                        <Name>' . $name . '</Name>
                        <CompanyName>' . $company_name . '</CompanyName>
                        <BillAddress>
                            <Addr1>' . $address1 . '</Addr1>
                        </BillAddress>
                        <ShipAddress>
                        <Addr1>' . $address2 . '</Addr1>
                        </ShipAddress>
                        <Phone>' . $phone . '</Phone>
                        <Email>' . $email . '</Email>
                        <Contact>' . $contact . '</Contact>
                    </CustomerAdd>
                </CustomerAddRq>
            </QBXMLMsgsRq>
        </QBXML>';

    return $qbxml;


}
function _quickbooks_customer_add_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{   


    // Great, customer $ID has been added to QuickBooks with a QuickBooks 
    //  ListID value of: $idents['ListID']
    // 
    // We probably want to store that ListID in our database, so we can use it 
    //  later. (You'll need to refer to the customer by either ListID or Name 
    //  in other requests, say, to update the customer or to add an invoice for 
    //  the customer. 

    $myHost = "localhost"; // use your real host name
$myUserName = "water_ways_user";   // use your real login user name
$myPassword = "zAEGQKI74YHyz6Do";   // use your real login password
$myDataBaseName = "water_ways"; // use your real database name

$con = mysqli_connect( "$myHost", "$myUserName", "$myPassword", "$myDataBaseName" );

if( !$con ) // == null if creation of connection object failed
{ 
    // report the error to the user, then exit program
    die("connection object not created: ".mysqli_error($con));
}

if( mysqli_connect_errno() )  // returns false if no error occurred
{ 
    // report the error to the user, then exit program
    die("Connect failed: ".mysqli_connect_errno()." : ". mysqli_connect_error());
}

    mysqli_query($con,"UPDATE customer_info SET quickbooks_listid = '" . mysqli_escape_string($con,$idents['ListID']) . "',edit_sequence = '" . mysqli_escape_string($con,$idents['EditSequence']) . "'  WHERE customer_info_id = " . (int) $ID);

}

这是我的.qwc文件,位于我的本地计算机上。

<?xml version="1.0"?>
<QBWCXML>
    <AppName>Water Ways</AppName>
    <AppID></AppID>
    <AppURL>https://pcits.co.in/water_ways/quickbooks-php-master/docs/web_connector/web_connector.php</AppURL>
    <AppDescription></AppDescription>
    <AppSupport>https://pcits.co.in/water_ways/</AppSupport>
    <CertURL>https://pcits.co.in/water_ways</CertURL>
    <UserName>quickbooks</UserName>
    <OwnerID>{90A44FB7-33D9-4815-AC85-AC86A7E7D1EB}</OwnerID>
    <FileID>{57F3B9B6-86F1-4fcc-B1FF-967DE1813D20}</FileID>
    <QBType>QBFS</QBType>
    <Scheduler>
        <RunEveryNMinutes>5</RunEveryNMinutes>
    </Scheduler>
    <IsReadOnly>false</IsReadOnly>
</QBWCXML>

并且由于“ QuickBooks Web连接器无法验证Web应用程序服务器证书。”而出现错误。

php quickbooks intuit qbxml
1个回答
0
投票

此错误消息:

QuickBooks Web Connector could not verify the web application server certificate.

表示您的域名(例如AppURL中显示的域名):

没有有效的SSL / TLS证书。

与您的网站托管公司/管理员交谈,并要求他们颁发/安装/配置安全的SSL证书。

© www.soinside.com 2019 - 2024. All rights reserved.