Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to insert data into tally using php?

i have fetch data from tally erp 9.0 using this code,

<?php
    $requestXML = '<ENVELOPE>'.
                           '<HEADER>'.
                           '<TALLYREQUEST>Export Data</TALLYREQUEST>'.
                           '</HEADER>'.
                           '<BODY>'.
                           '<EXPORTDATA>'.
                           '<REQUESTDESC>'.
                           '<REPORTNAME>Daybook</REPORTNAME>'.
                           '<STATICVARIABLES>'.
                           '<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>'.
                           '</STATICVARIABLES>'.
                           '</REQUESTDESC>'.
                           '</EXPORTDATA>'.
                           '</BODY>'.
                           '</ENVELOPE>';

 $server = 'LOCALHOST:9000';
 $headers = array( "Content-type: text/xml","Content-length:".strlen($requestXML) ,"Connection: close");

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $server);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestXML);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = curl_exec($ch);



if(curl_errno($ch)){
    print curl_error($ch);
    echo "  something went wrong..... try later";
}else{
echo " request accepted";
    print $data;
    curl_close($ch);
}

But my problem is how to push(insert) data into Tally ERP 9.0 using php(curl).

like image 382
Helping Hand.. Avatar asked Oct 21 '22 13:10

Helping Hand..


2 Answers

instead of

$server = 'LOCALHOST:9000';

give

$server = '10.0.0.155:9000';

like image 91
Helping Hand.. Avatar answered Oct 27 '22 09:10

Helping Hand..


use tally to generate xml format, and use same format to insert data back in to tally for eg. to create sale voucher, get the xml from tally i.e

GatewayOfTAlly-->Display-->Account Books--> Sales Register-->chhose month-->ctl+E to export the voucher,

Now you got the xml format, you are good to go.

like image 26
kecy Avatar answered Oct 27 '22 10:10

kecy