AnsweredAssumed Answered

RestServices, Logic hook and "There was an error while connecting to the server..."

Question asked by Brenda Quintero on May 7, 2015
Latest reply on May 13, 2015 by Rolustech Rolustech
version 7.5.x edition Enterprise.

I'm making a connection between Sugar and a RESTservice. 
Everything seems good, but when the services finish to save the data, sent by the logichook, into the sugar appears: "There was an error while connecting to the server...""

This is my logic hook:

hook_version = 1;   $hook_array = Array();   $hook_array['after_save'] = Array();   $hook_array['after_save'][] = Array(1,'Example Logic Hook','custom/modules/ARese_Resellers/accounts_save.php','Accounts_Save','test_dos',);  ?> 
And, the function:

<?phpclass Accounts_Save{
    function prueba_dos(&$bean, $event, $arguments){
$service_url = 'http://localhost:16390/api/ResellerCatalog';
$curl = curl_init($service_url);
$input = array(
   'FirstName' => $bean->name,
   'OfficePhone' => $bean->phone_office,
'City' => $bean->billing_address_city,
'Country'=> $bean->billing_address_country,
         'PostalCode'=> $bean->billing_address_postalcode,
         'State'=> $bean->billing_address_state,
         'Street'=> $bean->billing_address_street
   'EmailAddress' => $bean->emailAddress->addresses[0]['email_address'],
   'ShippingAddress'=> array(
               'City' => $bean->shipping_address_city,
               'Country'=> $bean->shipping_address_country,
         'PostalCode'=> $bean->shipping_address_postalcode,
         'State'=> $bean->shipping_address_state,
         'Street'=> $bean->shipping_address_street
'Website' => $bean->website,
'Type' => $bean->arese_avalonresellers_type,
'Status' => true,
'ExternalId' => $bean->id
//curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
//curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($input));
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$curl_response = curl_exec($curl);
if ($curl_response === false) {
   $info = curl_getinfo($curl); 
   die('error occured during curl exec. Additional info: ' . var_export($info));
The log file is empty.