Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将php与tally连接起来?_Php - Fatal编程技术网

如何将php与tally连接起来?

如何将php与tally连接起来?,php,Php,我想连接php和tally,我想用php在tally中存储分类账,有什么想法吗 我从不同的网站获得了参考,比如: 1) http://www.tallysolutions.com/website/html/tallydeveloper/integration-capabilities.php 2)http://stackoverflow.com/questions/15717941/how-to-insert-data-into-tally-using-php 但这不符合我的要求

我想连接php和tally,我想用php在tally中存储分类账,有什么想法吗

我从不同的网站获得了参考,比如:

   1) http://www.tallysolutions.com/website/html/tallydeveloper/integration-capabilities.php
   2)http://stackoverflow.com/questions/15717941/how-to-insert-data-into-tally-using-php
但这不符合我的要求

提前感谢

这可能会对您有所帮助

// create a new XML document
            $doc = new DomDocument('1.0', 'UTF-8');

            $envelope = $doc->appendChild($doc->createElement('ENVELOPE'));
            //Header Section                
            $header = $envelope->appendChild($doc->createElement('HEADER'));

            $version = $header->appendChild($doc->createElement('VERSION','6.3'));
            $import = $header->appendChild($doc->createElement('TALLYREQUEST','Import'));
            $type = $header->appendChild($doc->createElement('TYPE','Data'));
            $id = $header->appendChild($doc->createElement('ID','All Masters'));
            //End Header Section

            //Body Section
            $body = $envelope->appendChild($doc->createElement('BODY'));

            $desc = $body->appendChild($doc->createElement('DESC'));
            $static_var = $desc->appendChild($doc->createElement('STATICVARIABLES'));
            $dup_combine = $static_var->appendChild($doc->createElement('IMPORTDUPS','@@DUPCOMBINE'));

            $data = $body->appendChild($doc->createElement('DATA'));
            $tally_msg = $data->appendChild($doc->createElement('TALLYMESSAGE'));

            //Ledger Data
            foreach($contacts_data as $key => $value){
                $ledger = $tally_msg->appendChild($doc->createElement('LEDGER'));
                $parent=$ledger->appendChild($doc->createElement('PARENT',($value['contacts_types_id']=='1')?'Sundry Debtors':'Sundry Creditors'));
                $name=$ledger->appendChild($doc->createElement('NAME',trim(str_replace( "&"," AND ",$value['name']))));
                $address=$ledger->appendChild($doc->createElement('ADDRESS',trim(str_replace( "&"," AND ",$value['address']))));
                $state=$ledger->appendChild($doc->createElement('STATENAME',trim(str_replace( "&"," AND ",$value['state_name']))));
                $pincode=$ledger->appendChild($doc->createElement('PINCODE',$value['pincode']));

                /*$ledger_contact=$ledger->appendChild($doc->createElement('LEDGERCONTACT',trim(str_replace( "&"," AND ",$value['contact_person']))));
                $phone=$ledger->appendChild($doc->createElement('LEDGERPHONE',$value['phone']));
                $fax=$ledger->appendChild($doc->createElement('LEDGERFAX',$value['fax']));
                $mobile_no=$ledger->appendChild($doc->createElement('MOBILENO',$value['mobile_no']));
                $sales_tax_no=$ledger->appendChild($doc->createElement('SALESTAXNO','23456789'));
                $pan_no=$ledger->appendChild($doc->createElement('PANNO','453456789'));*/

                $o['contacts_id'][]=$value['id'];
            } 
            //End Ledger and Body Section

            //Write the XML nodes
            $fp = fopen(public_path()."/xml/import_tally/ledger.xml","wb");
            if(fwrite($fp,$doc->saveXML())){
                $o['tally_rslt']= shell_exec("curl -X POST tally_server_ip:port --data @".public_path()."/xml/import_tally/ledger.xml");
                $o['modified_result']=strpos(preg_replace('/[0-9]+/', '', $o['tally_rslt']),'exists');
            }
            fclose($fp);
            return $o;

欢迎来到SO,您需要详细说明您的需求,包括您到底在寻找什么,您尝试过什么?你的发现和代码应该发布在这里。通过这种方式,用户可以了解您正面临的问题,并附上适当的标签,您的问题将到达正确的人。