-
Notifications
You must be signed in to change notification settings - Fork 4
/
sample_code.php
63 lines (45 loc) · 1.95 KB
/
sample_code.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
// Load API
require_once "../../eway.class.php";
// Variable for our output
$table = '<style type="text/css">
table {
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: left;
}
tr:nth-child(even) {background-color: #f2f2f2;}
</style>';
// Search criteria
$company = array(
'FileAs' => 'Dorl & Son Inc'
);
// Create connector
$connector = new eWayConnector('https://trial.eway-crm.com/31994', 'api', 'ApiTrial@eWay-CRM');
// Search for the company
$output = $connector->searchCompanies($company);
// Open <table> tag for our output
$table .= '<table align="center">';
// Head of our output table
$table .= '<tr>
<td style="border: 1px solid black;"><b>Name</b></td>
<td style="border: 1px solid black;"><b>Address</b></td>
<td style="border: 1px solid black;"><b>Telephone</b></td>
</tr>';
// List through results
foreach ($output->Data as $item)
{
$table .= '<tr>'; // Open new table row
// Put the contact information we want into table cells
$table .= '<td style="border: 1px solid black;">'.$item->FileAs.'</td>
<td style="border: 1px solid black;">'.$item->Address1City.'<br>'.$item->Address1Street.' '.$item->Address1PostalCode.'</td>
<td style="border: 1px solid black;">'.$item->Phone.'</td>';
$table .= '</tr>'; // Close the table row
}
// Close the <table> tags
$table .= '</table>';
// Show the table with output
echo $table;
?>