-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowdata.php
42 lines (40 loc) · 1.85 KB
/
showdata.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php include("autentication.php") ?>
<?php
function showdata()
{
$endpoint_username = 'ICXCandidate';
$endpoint_password = 'Welcome2021';
$endpoint = "https://imaginecx--tst2.custhelp.com/services/rest/connect/v1.3/contacts";
$data = curl_init($endpoint);
$employees = autentication($data, $endpoint_username, $endpoint_password);
foreach ($employees->items as $employee) {
$id_employee = $employee->id;
$createdTime = strtotime($employee->createdTime);
$createdTime = date('d-m-Y', $createdTime);
//Obtain ID, name, created Time
echo "<tr><td>{$employee->id}</td>";
echo "<td>{$employee->lookupName}</td>";
echo "<td>{$createdTime}</td>";
$data = curl_init($employee->links[0]->href);
$contact_data = autentication($data, $endpoint_username, $endpoint_password);
//Obtain City
echo "<td>{$contact_data->address->city}</td>";
//Obtain email address
//primary auth
$data_emails = curl_init($contact_data->emails->links[0]->href);
$contact_emails = autentication($data_emails, $endpoint_username, $endpoint_password);
//secondary auth
$data_email = curl_init($contact_emails->items[0]->href);
$contact_address = autentication($data_email, $endpoint_username, $endpoint_password);
echo "<td>{$contact_address->address}</td>";
//Obtain phone number
//primary auth
$data_phones = curl_init($contact_data->phones->links[0]->href);
$contact_phones = autentication($data_phones, $endpoint_username, $endpoint_password);
//secondary auth
$data_phone = curl_init($contact_phones->items[0]->href);
$contact_number = autentication($data_phone, $endpoint_username, $endpoint_password);
echo "<td>{$contact_number->number}</td></tr>";
}
}
?>