title: access tally from php curl
body: <p>I am trying to insert data from php to tally using php curl,I have already succeeded in inserting data when i ran the code in tally in local machine by giving ip 127.0.0.1,but when i am trying it live curl is giving me error like connection timeout couldnot connect to host.
      I had also tried port forwarding. </p>
  
  <pre><code>        Below is my xml:
  
          &lt;ENVELOPE&gt;
    &lt;HEADER&gt;
      &lt;TALLYREQUEST&gt;Import Data&lt;/TALLYREQUEST&gt;
    &lt;/HEADER&gt;
    &lt;BODY&gt;
      &lt;IMPORTDATA&gt;
        &lt;REQUESTDESC&gt;
          &lt;REPORTNAME&gt;Vouchers&lt;/REPORTNAME&gt;
          &lt;STATICVARIABLES&gt; &lt;/STATICVARIABLES&gt;
        &lt;/REQUESTDESC&gt;
        &lt;REQUESTDATA&gt;
          &lt;TALLYMESSAGE xmlns:UDF="TallyUDF"&gt;
            &lt;VOUCHER  VCHTYPE="Sales" Action="Create"&gt;
              &lt;ISOPTIONAL&gt;No&lt;/ISOPTIONAL&gt;
              &lt;VOUCHERTYPENAME&gt;Sales&lt;/VOUCHERTYPENAME&gt;
              &lt;DATE&gt;20130413&lt;/DATE&gt;
              &lt;EFFECTIVEDATE&gt;20130413&lt;/EFFECTIVEDATE&gt;
              &lt;ISCANCELLED&gt;No&lt;/ISCANCELLED&gt;
              &lt;USETRACKINGNUMBER&gt;No&lt;/USETRACKINGNUMBER&gt;
              &lt;ISPOSTDATED&gt;No&lt;/ISPOSTDATED&gt;
              &lt;DIFFACTUALQTY&gt;No&lt;/DIFFACTUALQTY&gt;
              &lt;VOUCHERNUMBER&gt;11&lt;/VOUCHERNUMBER&gt;
              &lt;REFERENCE&gt;IS/11/13-14&lt;/REFERENCE&gt;
              &lt;PARTYLEDGERNAME&gt;INFOSOL&lt;/PARTYLEDGERNAME&gt;
              &lt;NARRATION&gt;Booked By: KUNAL SINGH | Used By: SANTOSH PARAB&lt;/NARRATION&gt;
              &lt;ASPAYSLIP&gt;No&lt;/ASPAYSLIP&gt;
              &lt;ALTERID&gt;11&lt;/ALTERID&gt;
              &lt;ALLLEDGERENTRIES.LIST&gt;
                &lt;REMOVEZEROENTRIES&gt;No&lt;/REMOVEZEROENTRIES&gt;
                &lt;ISDEEMEDPOSITIVE&gt;Yes&lt;/ISDEEMEDPOSITIVE&gt;
                &lt;LEDGERFROMITEM&gt;No&lt;/LEDGERFROMITEM&gt;
                &lt;LEDGERNAME&gt;INFOSOL&lt;/LEDGERNAME&gt;
                &lt;AMOUNT&gt;-2200.00&lt;/AMOUNT&gt;
                &lt;BILLALLOCATIONS.LIST&gt;
                  &lt;NAME&gt;IS/11/13-14&lt;/NAME&gt;
                  &lt;BILLTYPE&gt;New Ref&lt;/BILLTYPE&gt;
                  &lt;BILLCREDITPERIOD&gt;20130413&lt;/BILLCREDITPERIOD&gt;
                  &lt;AMOUNT&gt;-2200.00&lt;/AMOUNT&gt;
                &lt;/BILLALLOCATIONS.LIST&gt;
              &lt;/ALLLEDGERENTRIES.LIST&gt;
              &lt;ALLLEDGERENTRIES.LIST&gt;
                &lt;REMOVEZEROENTRIES&gt;No&lt;/REMOVEZEROENTRIES&gt;
                &lt;ISDEEMEDPOSITIVE&gt;Yes&lt;/ISDEEMEDPOSITIVE&gt;
                &lt;LEDGERFROMITEM&gt;No&lt;/LEDGERFROMITEM&gt;
                &lt;LEDGERNAME&gt;Rental Income&lt;/LEDGERNAME&gt;
                &lt;AMOUNT&gt;1000.00&lt;/AMOUNT&gt;
                &lt;CATEGORYALLOCATIONS.LIST&gt;
                  &lt;CATEGORY&gt;Primary Cost Category&lt;/CATEGORY&gt;
                  &lt;COSTCENTREALLOCATIONS.LIST&gt;
                    &lt;NAME&gt;Rental Income&lt;/NAME&gt;
                    &lt;AMOUNT&gt;1000.00&lt;/AMOUNT&gt;
                  &lt;/COSTCENTREALLOCATIONS.LIST&gt;
                &lt;/CATEGORYALLOCATIONS.LIST&gt;
              &lt;/ALLLEDGERENTRIES.LIST&gt;
              &lt;ALLLEDGERENTRIES.LIST&gt;
                &lt;REMOVEZEROENTRIES&gt;No&lt;/REMOVEZEROENTRIES&gt;
                &lt;ISDEEMEDPOSITIVE&gt;No&lt;/ISDEEMEDPOSITIVE&gt;
                &lt;LEDGERFROMITEM&gt;No&lt;/LEDGERFROMITEM&gt;
                &lt;LEDGERNAME&gt;Parking N Toll&lt;/LEDGERNAME&gt;
                &lt;AMOUNT&gt;1200.00&lt;/AMOUNT&gt;
              &lt;/ALLLEDGERENTRIES.LIST&gt;
            &lt;/VOUCHER&gt;
          &lt;/TALLYMESSAGE&gt;
        &lt;/REQUESTDATA&gt;
      &lt;/IMPORTDATA&gt;
    &lt;/BODY&gt;
  &lt;/ENVELOPE&gt;
  
  
      And here is my php:
      $server = "http://".$_SERVER['REMOTE_ADDR'].":9000";
       $headers = array( "Content-type: text/xml" ,"Content-length: ".strlen($strXML) ,"Connection: close" );
  
      $ch = curl_init(); 
      curl_setopt($ch, CURLOPT_URL,$server);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_TIMEOUT, 20);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $strXML);
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      $server_output = curl_exec($ch);
  
  
  
      if(curl_errno($ch)){
          echo curl_error($ch);
          echo " $server  something went wrong..... try later ";
          if($_GET[counter]==$_GET[total])
          echo 'done###';
      }else{
  
          curl_close($ch);
      }
  </code></pre>