Unable to add estimate using API with PHP

Unable to add estimate using API with PHP

Hi !,

I am not able to add an estimate using the API with php. No error is shown too.

openssl :enabled.

my php code is as below. 

Thanks in advance!

<?php
function do_post_request($url, $data, $optional_headers = null)
{
      $params = array('http' => array('method' => 'POST','content' => $data));    
      if ($optional_headers !== null)
      {
            $params['http']['header'] = $optional_headers;
      }
      $ctx = stream_context_create($params);
      $fp = @fopen($url, 'rb', false, $ctx);
      if (!$fp)
      {
            echo "Problem with $url";
      }
      $response = @stream_get_contents($fp);
      if ($response === false)
      {
            echo "Problem reading data from $url";
      }
      return $response;
}
$url = 'https://invoice.zoho.com/api/estimates/create?newFormat=1&authtoken=myauthtoken&scope=invoiceapi&apikey=myapikey';

$data
= 'XMLString=<Estimate>
    <CustomerID>364088000000022005</CustomerID> 
    <EstimateDate>2009-09-06</EstimateDate>
    <EstimateNumber>EST 4</EstimateNumber>
    <ReferenceNumber>121</ReferenceNumber>
    <ExchangeRate>10</ExchangeRate>
    <Custom.Body>This is the mail content</Custom.Body>
    <Custom.Subject>This is mail subject</Custom.Subject>
    <EstimateItems>
        <EstimateItem>
            <ProductID>3000000000332</ProductID> 
        </EstimateItem>
        <EstimateItem>
            <ItemName>Sample Item</ItemName>
            <ItemDescription>Sample Description</ItemDescription>
            <Price>34</Price>    
            <Tax1Name>PST</Tax1Name>
        </EstimateItem>
    </EstimateItems>
    <Comments>
        <Comment>
            <Description>Comment added to an invoice</Description> 
        </Comment>
    </Comments>
    <Notes>Estimate Notes will be shown in PDF</Notes>
    <Terms>Terms and Conditions apply</Terms>
</Estimate>';
do_post_request($url, $data);
?>