第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

想要將 quickbooks 桌面與 php 集成

想要將 quickbooks 桌面與 php 集成

PHP
慕容3067478 2022-07-16 18:50:22
我正在嘗試使用以下 github 存儲(chǔ)庫(kù)集成 quickbook 桌面版本:https://github.com/consolibyte/quickbooks-php但是當(dāng)我使用您的示例代碼(即 mydomain.com/qb_desktop/docs/web_connector/customer.php)創(chuàng)建自定義新文件以從我們的網(wǎng)站將客戶創(chuàng)建到 QB 桌面應(yīng)用程序中時(shí)在 Web 連接器中添加此文件并運(yùn)行此文件后,它會(huì)繼續(xù)運(yùn)行并不斷創(chuàng)建新的無限客戶,直到我在 php 腳本中添加“die”以強(qiáng)制停止此操作。你能看看我下面的代碼,讓我知道我在這里到底做錯(cuò)了什么嗎?提前致謝。<?php$primary_key_of_your_customer = 5;require_once '../../QuickBooks.php';$user = 'user';$pass = 'password';$map = array(QUICKBOOKS_ADD_CUSTOMER => array( '_quickbooks_customer_add_request', '_quickbooks_customer_add_response'));$errmap = array( 3070 => '_quickbooks_error_stringtoolong');$hooks = array();$log_level = QUICKBOOKS_LOG_DEBUG;  $soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN;$soap_options = array();$handler_options = array('deny_concurrent_logins' => false,            'deny_reallyfast_logins' => false);$driver_options = array();$callback_options = array();$dsn = 'mysqli://root:password@localhost/quickbooks';$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);$Queue = new QuickBooks_WebConnector_Queue($dsn);$Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $primary_key_of_your_customer);function _quickbooks_customer_add_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale){    $xml = '<?xml version="1.0" encoding="utf-8"?>        <?qbxml version="2.0"?>        <QBXML>            <QBXMLMsgsRq onError="stopOnError">                <CustomerAddRq requestID="' . $requestID . '">                    <CustomerAdd>                        <Name>ConsoliBYTE, LLC (' . mt_rand() . ')</Name>
查看完整描述

1 回答

?
撒科打諢

TA貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊

Web 連接器是基于 SOAP 的,因此您實(shí)際上在這里所做的是設(shè)置 Web 連接器連接到的 SOAP 服務(wù)器。

這里需要意識(shí)到的重要一點(diǎn)是,Web 連接器每次連接時(shí)都會(huì)對(duì) SOAP 服務(wù)進(jìn)行多次調(diào)用(例如,對(duì)您的 PHP 腳本進(jìn)行許多獨(dú)立的 HTTP 請(qǐng)求)。至少,即使沒有要交換的實(shí)際數(shù)據(jù),它也至少會(huì)進(jìn)行 4 次調(diào)用:

  • 客戶端版本

  • 服務(wù)器版本

  • 認(rèn)證

  • 關(guān)閉連接

這意味著每次 Web 連接器連接到您的服務(wù)以嘗試與 QuickBooks 交換數(shù)據(jù)時(shí),您在 PHP 腳本中放置的任何內(nèi)容都至少運(yùn)行 4 次。所以每次 Web 連接器連接時(shí),這段代碼至少運(yùn)行 4 次

$Queue = new QuickBooks_WebConnector_Queue($dsn);

$Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $primary_key_of_your_customer);

你不應(yīng)該在這個(gè)文件中有這段代碼。它應(yīng)該在其他地方。從這個(gè)文件中刪除它,你的問題就會(huì)消失。


相反,請(qǐng)修改您的 Web 應(yīng)用程序,以便在您的 Web 應(yīng)用程序中創(chuàng)建新客戶時(shí),同時(shí)將 QuickBooks 請(qǐng)求排隊(duì)。所以當(dāng)你做這樣的事情時(shí),在你的應(yīng)用程序的某個(gè)地方:


// Person submitted the form, so save the data they submitted into my database

$my_customer['first_name'] = $_POST['first_name'];

$my_customer['last_name'] = $_POST['last_name'];


$my_customer_id = $MyModelOrDatabase->insert('customer_table', $my_customer);

你應(yīng)該做這個(gè):


// Person submitted the form, so save the data they submitted into my database

$my_customer['first_name'] = $_POST['first_name'];

$my_customer['last_name'] = $_POST['last_name'];


$my_customer_id = $MyModelOrDatabase->insert('customer_table', $my_customer);


if ($my_customer_id)

{

    $Queue = new QuickBooks_WebConnector_Queue($dsn);

    $Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $my_customer_id);

}

這會(huì)將一條記錄放入 QuickBooks 的隊(duì)列中。然后,當(dāng) Web 連接器連接時(shí),它可以從您已經(jīng)構(gòu)建的隊(duì)列中提取并處理它。


如果您查看示例,則有一個(gè)示例可以說明這一點(diǎn):


https://github.com/consolibyte/quickbooks-php/tree/master/docs/web_connector/example_app_web_connector

具體來說,這個(gè)例子:


https://github.com/consolibyte/quickbooks-php/blob/master/docs/web_connector/example_app_web_connector/handler.php

看起來像這樣:


// Handle the form post

if (isset($_POST['submitted']))

{

    // Save the record

    mysql_query("

        INSERT INTO

            my_customer_table

        (

            name, 

            fname, 

            lname

        ) VALUES (

            '" . mysql_escape_string($_POST['name']) . "', 

            '" . mysql_escape_string($_POST['fname']) . "', 

            '" . mysql_escape_string($_POST['lname']) . "'

        )");


    // Get the primary key of the new record

    $id = mysql_insert_id();


    // Queue up the customer add 

    $Queue = new QuickBooks_WebConnector_Queue($dsn);

    $Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $id);


    die('Great, queued up a customer!');

}

如果您查看文檔,他們實(shí)際上明確警告您不要做到目前為止所做的事情:


https://github.com/consolibyte/quickbooks-php/blob/master/docs/web_connector/example_web_connector.php#L284

文件:


    // NOTE: You would normally *never* want to do this in this file! This is 

    //  meant as an initial test ONLY. See example_web_connector_queueing.php for more 

    //  details!

    // 

    // IMPORTANT NOTE: This particular example of queueing something up will 

    //  only ever happen *once* when these scripts are first run/used. After 

    //  this initial test, you MUST do your queueing in another script. DO NOT 

    //  DO YOUR OWN QUEUEING IN THIS FILE! See 

    //  docs/example_web_connector_queueing.php for more details and examples 

    //  of queueing things up.


查看完整回答
反對(duì) 回復(fù) 2022-07-16
  • 1 回答
  • 0 關(guān)注
  • 99 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)