problem in inserting records

problem in inserting records

Hi

We (sortmybooks) are long term customer of zoho crm and when i tried to insert records from our application to our own crm account, it is bringing us 4500 error. But it is working fine when we test this with couple of trial crm accounts. The problem occurs only in our licensed crm account. I am pasting the code here. please point out where am i going wrong.

public function insertZohoRecords($first_name=null,$last_name=null,$email=null,$phone=null) {
        $zoho_api=$this->api->getConfig('Zoho_apikey');
        $ticket=$this->getZohoTicket();       
        $zoho_url='http://crm.zoho.com/crm/private/xml/Contacts/insertRecords?';
       
        $xml=$this->getZohoXML($first_name,$last_name,$email,$phone);
        //$xml=htmlspecialchars($xml);
       
        $data='newFormat=1&apikey='.$zoho_api.'&ticket='.$ticket.'&xmlData='.$xml;
       
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_URL, $zoho_url);
        $result = curl_exec($ch);
        //print_r($result);
        $error=curl_error($ch);
        if($error)
            throw Exception_ForUser('Error in inserting records to Zoho CRM');
        curl_close($ch);
    }
    /***
        * This function is used to generate the xml to insert the contacts to the xml
        * It takes the form data as input and generates the xml
        * Result is the xml data
    ***/
    public function getZohoXML($first_name=null,$last_name=null,$email=null,$phone=null) {
        $data='<Contacts>
                    <row no="1">
                        <FL val="First Name">'.$first_name.'</FL>
                        <FL val="Last Name">'.$last_name.'</FL>
                        <FL val="Email">'.$email.'</FL>
                        <FL val="Phone">'.$phone.'</FL>
                        <FL val="Product Downloaded">SMBOnline</FL>
                        <FL val="Contact Type">Online Trial</FL>
                    </row>
                </Contacts>';
        return $data;

    }
    /***
        * This function is used to generate the ticket for every 7 days
        * It has no arguments but checks with the cofig parameter of last generated date and
        * if the difference between the last generated date and today is equal to 7. then the
        * system generates a new ticket for use.
        * The output is the newly generated ticket.
    ***/
    private function getZohoTicket() {
        $url = "https://accounts.zoho.com/login?";  
        $datais='LOGIN_ID='.$this->api->getConfig("Zoho_username").'&PASSWORD='.$this->api->getConfig("Zoho_password").'&FROM_AGENT=true&servicename=ZohoCRM';
      
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$datais);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $result=curl_exec($ch);
        if(!$result)
            throw Exception_ForUser('Error in zoho Ticket Generation');
        $start=strpos($result,"TICKET=")+7;
        $length=strpos($result,"RESULT")-1;
        $data=substr($result,$start,$length-$start);
        curl_close($ch);
        return $data;
       
    }

Note: It is inserting records on trial versions of crm account but not in our licensed version And also our licensed version contains '-' symbol in the api key. Is this ok .

Thanks
Satheeskumar A