#!/usr/bin/php -q getMessage(); } } function PausaCampanha($ipServidor, $arListas) { try{ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://{$ipServidor}/kingdialer/kingAPI.php?action=pausecamp&id_camp={$arListas}&login=uditelecom"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $content = trim(curl_exec($ch)); curl_close($ch); $retorno = json_decode($content); if(empty($retorno)){ throw new Exception("Erro ao realizar o procedimento"); } $ret = objectToArray($retorno); return $ret['status']; } catch (Exception $ex) { return $ex->getMessage(); } } function objectToArray($d) { if (is_object($d)) { $d = get_object_vars($d); } if (is_array($d)) { return array_map(__FUNCTION__, $d); } else { return $d; } }