diff --git a/README.md b/README.md index 05a8003..7dbffe7 100644 --- a/README.md +++ b/README.md @@ -43,14 +43,25 @@ Ejemplos de llamadas al API: ->getContacts('12345678' /* Or a name, it works too */, /*limit*/ 10,/* offset */ 0, /* contact status */'SUSCRIBED'); - if ($contacts->ok) /* do something */ ; + if ($response->ok){ + /* Do something */ + echo "Mis contactos son: \n"; + foreach ($response->data as $contact){ + echo "$contact->msisdn : $contact->first_name\n"; + } + } $groups = $api->groups() ->getGroups("my group" /*$query*/, 0 /*$limit*/,0 /* $offset */, false /*$shortResults*/); - if ($groups->ok) /* do something */ ; + if ($groups->ok){ + echo "Mis grupos\n"; + foreach ($groups->data as $group){ + echo " Grupo: $group->name, miembros: {$group->members->total}\n"; + } + } $message = $api->messages() diff --git a/src/libs/ApiWrapper.php b/src/libs/ApiWrapper.php index 3e89528..24c05fc 100644 --- a/src/libs/ApiWrapper.php +++ b/src/libs/ApiWrapper.php @@ -126,8 +126,8 @@ public function send($url, $params, $method, $body){ $has_status = preg_match('/\ ([^\ ]+)$/', $http_response_header[0], $status); if ($has_status) $status = $status[1]; $data = array( - 'code' => $response_code, - 'status' => $status+0, + 'code' => $response_code+0, + 'status' => $status, 'ok' => $status=="OK", 'response_headers' => $http_response_header, 'data' => $json,