/var/www/hkosl.com/nick/codeigniter/application/vendor/sendgrid/sendgrid/examples/ips/ips.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
// If you are using Composer
require 'vendor/autoload.php';


$apiKey getenv('SENDGRID_API_KEY');
$sg = new \SendGrid($apiKey);

////////////////////////////////////////////////////
// Retrieve all IP addresses #
// GET /ips #

$query_params json_decode('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}');
$response $sg->client->ips()->get(null$query_params);
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Retrieve all assigned IPs #
// GET /ips/assigned #

$response $sg->client->ips()->assigned()->get();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Create an IP pool. #
// POST /ips/pools #

$request_body json_decode('{
  "name": "marketing"
}'
);
$response $sg->client->ips()->pools()->post($request_body);
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Retrieve all IP pools. #
// GET /ips/pools #

$response $sg->client->ips()->pools()->get();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Update an IP pools name. #
// PUT /ips/pools/{pool_name} #

$request_body json_decode('{
  "name": "new_pool_name"
}'
);
$pool_name "test_url_param";
$response $sg->client->ips()->pools()->_($pool_name)->put($request_body);
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Retrieve all IPs in a specified pool. #
// GET /ips/pools/{pool_name} #

$pool_name "test_url_param";
$response $sg->client->ips()->pools()->_($pool_name)->get();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Delete an IP pool. #
// DELETE /ips/pools/{pool_name} #

$pool_name "test_url_param";
$response $sg->client->ips()->pools()->_($pool_name)->delete();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Add an IP address to a pool #
// POST /ips/pools/{pool_name}/ips #

$request_body json_decode('{
  "ip": "0.0.0.0"
}'
);
$pool_name "test_url_param";
$response $sg->client->ips()->pools()->_($pool_name)->ips()->post($request_body);
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Remove an IP address from a pool. #
// DELETE /ips/pools/{pool_name}/ips/{ip} #

$pool_name "test_url_param";
$ip "test_url_param";
$response $sg->client->ips()->pools()->_($pool_name)->ips()->_($ip)->delete();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Add an IP to warmup #
// POST /ips/warmup #

$request_body json_decode('{
  "ip": "0.0.0.0"
}'
);
$response $sg->client->ips()->warmup()->post($request_body);
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Retrieve all IPs currently in warmup #
// GET /ips/warmup #

$response $sg->client->ips()->warmup()->get();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Retrieve warmup status for a specific IP address #
// GET /ips/warmup/{ip_address} #

$ip_address "test_url_param";
$response $sg->client->ips()->warmup()->_($ip_address)->get();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Remove an IP from warmup #
// DELETE /ips/warmup/{ip_address} #

$ip_address "test_url_param";
$response $sg->client->ips()->warmup()->_($ip_address)->delete();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());

////////////////////////////////////////////////////
// Retrieve all IP pools an IP address belongs to #
// GET /ips/{ip_address} #

$ip_address "test_url_param";
$response $sg->client->ips()->_($ip_address)->get();
echo 
$response->statusCode();
echo 
$response->body();
print_r($response->headers());