@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | $apiKey = getenv('SENDGRID_API_KEY'); |
| 8 | 8 | $sg = new \SendGrid($apiKey); |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | try { |
| 25 | 25 | $response = $sg->client->subusers()->post($request_body); |
| 26 | - print $response->statusCode() . "\n"; |
|
| 26 | + print $response->statusCode()."\n"; |
|
| 27 | 27 | print_r($response->headers()); |
| 28 | - print $response->body() . "\n"; |
|
| 28 | + print $response->body()."\n"; |
|
| 29 | 29 | } catch (Exception $e) { |
| 30 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 30 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | //////////////////////////////////////////////////// |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | try { |
| 40 | 40 | $response = $sg->client->subusers()->get(null, $query_params); |
| 41 | - print $response->statusCode() . "\n"; |
|
| 41 | + print $response->statusCode()."\n"; |
|
| 42 | 42 | print_r($response->headers()); |
| 43 | - print $response->body() . "\n"; |
|
| 43 | + print $response->body()."\n"; |
|
| 44 | 44 | } catch (Exception $e) { |
| 45 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 45 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | //////////////////////////////////////////////////// |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | try { |
| 55 | 55 | $response = $sg->client->subusers()->reputations()->get(null, $query_params); |
| 56 | - print $response->statusCode() . "\n"; |
|
| 56 | + print $response->statusCode()."\n"; |
|
| 57 | 57 | print_r($response->headers()); |
| 58 | - print $response->body() . "\n"; |
|
| 58 | + print $response->body()."\n"; |
|
| 59 | 59 | } catch (Exception $e) { |
| 60 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 60 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | //////////////////////////////////////////////////// |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | try { |
| 70 | 70 | $response = $sg->client->subusers()->stats()->get(null, $query_params); |
| 71 | - print $response->statusCode() . "\n"; |
|
| 71 | + print $response->statusCode()."\n"; |
|
| 72 | 72 | print_r($response->headers()); |
| 73 | - print $response->body() . "\n"; |
|
| 73 | + print $response->body()."\n"; |
|
| 74 | 74 | } catch (Exception $e) { |
| 75 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 75 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | //////////////////////////////////////////////////// |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | try { |
| 85 | 85 | $response = $sg->client->subusers()->stats()->monthly()->get(null, $query_params); |
| 86 | - print $response->statusCode() . "\n"; |
|
| 86 | + print $response->statusCode()."\n"; |
|
| 87 | 87 | print_r($response->headers()); |
| 88 | - print $response->body() . "\n"; |
|
| 88 | + print $response->body()."\n"; |
|
| 89 | 89 | } catch (Exception $e) { |
| 90 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 90 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | //////////////////////////////////////////////////// |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | try { |
| 100 | 100 | $response = $sg->client->subusers()->stats()->sums()->get(null, $query_params); |
| 101 | - print $response->statusCode() . "\n"; |
|
| 101 | + print $response->statusCode()."\n"; |
|
| 102 | 102 | print_r($response->headers()); |
| 103 | - print $response->body() . "\n"; |
|
| 103 | + print $response->body()."\n"; |
|
| 104 | 104 | } catch (Exception $e) { |
| 105 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 105 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | //////////////////////////////////////////////////// |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | try { |
| 118 | 118 | $response = $sg->client->subusers()->_($subuser_name)->patch($request_body); |
| 119 | - print $response->statusCode() . "\n"; |
|
| 119 | + print $response->statusCode()."\n"; |
|
| 120 | 120 | print_r($response->headers()); |
| 121 | - print $response->body() . "\n"; |
|
| 121 | + print $response->body()."\n"; |
|
| 122 | 122 | } catch (Exception $e) { |
| 123 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 123 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | //////////////////////////////////////////////////// |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | try { |
| 133 | 133 | $response = $sg->client->subusers()->_($subuser_name)->delete(); |
| 134 | - print $response->statusCode() . "\n"; |
|
| 134 | + print $response->statusCode()."\n"; |
|
| 135 | 135 | print_r($response->headers()); |
| 136 | - print $response->body() . "\n"; |
|
| 136 | + print $response->body()."\n"; |
|
| 137 | 137 | } catch (Exception $e) { |
| 138 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 138 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | //////////////////////////////////////////////////// |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | try { |
| 151 | 151 | $response = $sg->client->subusers()->_($subuser_name)->ips()->put($request_body); |
| 152 | - print $response->statusCode() . "\n"; |
|
| 152 | + print $response->statusCode()."\n"; |
|
| 153 | 153 | print_r($response->headers()); |
| 154 | - print $response->body() . "\n"; |
|
| 154 | + print $response->body()."\n"; |
|
| 155 | 155 | } catch (Exception $e) { |
| 156 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 156 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | //////////////////////////////////////////////////// |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | try { |
| 170 | 170 | $response = $sg->client->subusers()->_($subuser_name)->monitor()->put($request_body); |
| 171 | - print $response->statusCode() . "\n"; |
|
| 171 | + print $response->statusCode()."\n"; |
|
| 172 | 172 | print_r($response->headers()); |
| 173 | - print $response->body() . "\n"; |
|
| 173 | + print $response->body()."\n"; |
|
| 174 | 174 | } catch (Exception $e) { |
| 175 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 175 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | //////////////////////////////////////////////////// |
@@ -187,11 +187,11 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | try { |
| 189 | 189 | $response = $sg->client->subusers()->_($subuser_name)->monitor()->post($request_body); |
| 190 | - print $response->statusCode() . "\n"; |
|
| 190 | + print $response->statusCode()."\n"; |
|
| 191 | 191 | print_r($response->headers()); |
| 192 | - print $response->body() . "\n"; |
|
| 192 | + print $response->body()."\n"; |
|
| 193 | 193 | } catch (Exception $e) { |
| 194 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 194 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | //////////////////////////////////////////////////// |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | try { |
| 204 | 204 | $response = $sg->client->subusers()->_($subuser_name)->monitor()->get(); |
| 205 | - print $response->statusCode() . "\n"; |
|
| 205 | + print $response->statusCode()."\n"; |
|
| 206 | 206 | print_r($response->headers()); |
| 207 | - print $response->body() . "\n"; |
|
| 207 | + print $response->body()."\n"; |
|
| 208 | 208 | } catch (Exception $e) { |
| 209 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 209 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | //////////////////////////////////////////////////// |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | try { |
| 219 | 219 | $response = $sg->client->subusers()->_($subuser_name)->monitor()->delete(); |
| 220 | - print $response->statusCode() . "\n"; |
|
| 220 | + print $response->statusCode()."\n"; |
|
| 221 | 221 | print_r($response->headers()); |
| 222 | - print $response->body() . "\n"; |
|
| 222 | + print $response->body()."\n"; |
|
| 223 | 223 | } catch (Exception $e) { |
| 224 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 224 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | //////////////////////////////////////////////////// |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | try { |
| 235 | 235 | $response = $sg->client->subusers()->_($subuser_name)->stats()->monthly()->get(null, $query_params); |
| 236 | - print $response->statusCode() . "\n"; |
|
| 236 | + print $response->statusCode()."\n"; |
|
| 237 | 237 | print_r($response->headers()); |
| 238 | - print $response->body() . "\n"; |
|
| 238 | + print $response->body()."\n"; |
|
| 239 | 239 | } catch (Exception $e) { |
| 240 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 240 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 241 | 241 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | $apiKey = getenv('SENDGRID_API_KEY'); |
| 8 | 8 | $sg = new \SendGrid($apiKey); |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | try { |
| 15 | 15 | $response = $sg->client->user()->account()->get(); |
| 16 | - print $response->statusCode() . "\n"; |
|
| 16 | + print $response->statusCode()."\n"; |
|
| 17 | 17 | print_r($response->headers()); |
| 18 | - print $response->body() . "\n"; |
|
| 18 | + print $response->body()."\n"; |
|
| 19 | 19 | } catch (Exception $e) { |
| 20 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 20 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | //////////////////////////////////////////////////// |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | try { |
| 28 | 28 | $response = $sg->client->user()->credits()->get(); |
| 29 | - print $response->statusCode() . "\n"; |
|
| 29 | + print $response->statusCode()."\n"; |
|
| 30 | 30 | print_r($response->headers()); |
| 31 | - print $response->body() . "\n"; |
|
| 31 | + print $response->body()."\n"; |
|
| 32 | 32 | } catch (Exception $e) { |
| 33 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 33 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | //////////////////////////////////////////////////// |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | try { |
| 45 | 45 | $response = $sg->client->user()->email()->put($request_body); |
| 46 | - print $response->statusCode() . "\n"; |
|
| 46 | + print $response->statusCode()."\n"; |
|
| 47 | 47 | print_r($response->headers()); |
| 48 | - print $response->body() . "\n"; |
|
| 48 | + print $response->body()."\n"; |
|
| 49 | 49 | } catch (Exception $e) { |
| 50 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 50 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | //////////////////////////////////////////////////// |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | try { |
| 58 | 58 | $response = $sg->client->user()->email()->get(); |
| 59 | - print $response->statusCode() . "\n"; |
|
| 59 | + print $response->statusCode()."\n"; |
|
| 60 | 60 | print_r($response->headers()); |
| 61 | - print $response->body() . "\n"; |
|
| 61 | + print $response->body()."\n"; |
|
| 62 | 62 | } catch (Exception $e) { |
| 63 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 63 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | //////////////////////////////////////////////////// |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | try { |
| 76 | 76 | $response = $sg->client->user()->password()->put($request_body); |
| 77 | - print $response->statusCode() . "\n"; |
|
| 77 | + print $response->statusCode()."\n"; |
|
| 78 | 78 | print_r($response->headers()); |
| 79 | - print $response->body() . "\n"; |
|
| 79 | + print $response->body()."\n"; |
|
| 80 | 80 | } catch (Exception $e) { |
| 81 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 81 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | //////////////////////////////////////////////////// |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | try { |
| 95 | 95 | $response = $sg->client->user()->profile()->patch($request_body); |
| 96 | - print $response->statusCode() . "\n"; |
|
| 96 | + print $response->statusCode()."\n"; |
|
| 97 | 97 | print_r($response->headers()); |
| 98 | - print $response->body() . "\n"; |
|
| 98 | + print $response->body()."\n"; |
|
| 99 | 99 | } catch (Exception $e) { |
| 100 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 100 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | //////////////////////////////////////////////////// |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | try { |
| 109 | 109 | $response = $sg->client->user()->profile()->get(); |
| 110 | - print $response->statusCode() . "\n"; |
|
| 110 | + print $response->statusCode()."\n"; |
|
| 111 | 111 | print_r($response->headers()); |
| 112 | - print $response->body() . "\n"; |
|
| 112 | + print $response->body()."\n"; |
|
| 113 | 113 | } catch (Exception $e) { |
| 114 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 114 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | //////////////////////////////////////////////////// |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | try { |
| 127 | 127 | $response = $sg->client->user()->scheduled_sends()->post($request_body); |
| 128 | - print $response->statusCode() . "\n"; |
|
| 128 | + print $response->statusCode()."\n"; |
|
| 129 | 129 | print_r($response->headers()); |
| 130 | - print $response->body() . "\n"; |
|
| 130 | + print $response->body()."\n"; |
|
| 131 | 131 | } catch (Exception $e) { |
| 132 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 132 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | //////////////////////////////////////////////////// |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | try { |
| 140 | 140 | $response = $sg->client->user()->scheduled_sends()->get(); |
| 141 | - print $response->statusCode() . "\n"; |
|
| 141 | + print $response->statusCode()."\n"; |
|
| 142 | 142 | print_r($response->headers()); |
| 143 | - print $response->body() . "\n"; |
|
| 143 | + print $response->body()."\n"; |
|
| 144 | 144 | } catch (Exception $e) { |
| 145 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 145 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | //////////////////////////////////////////////////// |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | try { |
| 158 | 158 | $response = $sg->client->user()->scheduled_sends()->_($batch_id)->patch($request_body); |
| 159 | - print $response->statusCode() . "\n"; |
|
| 159 | + print $response->statusCode()."\n"; |
|
| 160 | 160 | print_r($response->headers()); |
| 161 | - print $response->body() . "\n"; |
|
| 161 | + print $response->body()."\n"; |
|
| 162 | 162 | } catch (Exception $e) { |
| 163 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 163 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | //////////////////////////////////////////////////// |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | try { |
| 173 | 173 | $response = $sg->client->user()->scheduled_sends()->_($batch_id)->get(); |
| 174 | - print $response->statusCode() . "\n"; |
|
| 174 | + print $response->statusCode()."\n"; |
|
| 175 | 175 | print_r($response->headers()); |
| 176 | - print $response->body() . "\n"; |
|
| 176 | + print $response->body()."\n"; |
|
| 177 | 177 | } catch (Exception $e) { |
| 178 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 178 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | //////////////////////////////////////////////////// |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | try { |
| 188 | 188 | $response = $sg->client->user()->scheduled_sends()->_($batch_id)->delete(); |
| 189 | - print $response->statusCode() . "\n"; |
|
| 189 | + print $response->statusCode()."\n"; |
|
| 190 | 190 | print_r($response->headers()); |
| 191 | - print $response->body() . "\n"; |
|
| 191 | + print $response->body()."\n"; |
|
| 192 | 192 | } catch (Exception $e) { |
| 193 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 193 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | //////////////////////////////////////////////////// |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | try { |
| 206 | 206 | $response = $sg->client->user()->settings()->enforced_tls()->patch($request_body); |
| 207 | - print $response->statusCode() . "\n"; |
|
| 207 | + print $response->statusCode()."\n"; |
|
| 208 | 208 | print_r($response->headers()); |
| 209 | - print $response->body() . "\n"; |
|
| 209 | + print $response->body()."\n"; |
|
| 210 | 210 | } catch (Exception $e) { |
| 211 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 211 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | //////////////////////////////////////////////////// |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | try { |
| 219 | 219 | $response = $sg->client->user()->settings()->enforced_tls()->get(); |
| 220 | - print $response->statusCode() . "\n"; |
|
| 220 | + print $response->statusCode()."\n"; |
|
| 221 | 221 | print_r($response->headers()); |
| 222 | - print $response->body() . "\n"; |
|
| 222 | + print $response->body()."\n"; |
|
| 223 | 223 | } catch (Exception $e) { |
| 224 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 224 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | //////////////////////////////////////////////////// |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | try { |
| 236 | 236 | $response = $sg->client->user()->username()->put($request_body); |
| 237 | - print $response->statusCode() . "\n"; |
|
| 237 | + print $response->statusCode()."\n"; |
|
| 238 | 238 | print_r($response->headers()); |
| 239 | - print $response->body() . "\n"; |
|
| 239 | + print $response->body()."\n"; |
|
| 240 | 240 | } catch (Exception $e) { |
| 241 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 241 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | //////////////////////////////////////////////////// |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | try { |
| 249 | 249 | $response = $sg->client->user()->username()->get(); |
| 250 | - print $response->statusCode() . "\n"; |
|
| 250 | + print $response->statusCode()."\n"; |
|
| 251 | 251 | print_r($response->headers()); |
| 252 | - print $response->body() . "\n"; |
|
| 252 | + print $response->body()."\n"; |
|
| 253 | 253 | } catch (Exception $e) { |
| 254 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 254 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | //////////////////////////////////////////////////// |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | try { |
| 278 | 278 | $response = $sg->client->user()->webhooks()->event()->settings()->patch($request_body); |
| 279 | - print $response->statusCode() . "\n"; |
|
| 279 | + print $response->statusCode()."\n"; |
|
| 280 | 280 | print_r($response->headers()); |
| 281 | - print $response->body() . "\n"; |
|
| 281 | + print $response->body()."\n"; |
|
| 282 | 282 | } catch (Exception $e) { |
| 283 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 283 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | //////////////////////////////////////////////////// |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | try { |
| 291 | 291 | $response = $sg->client->user()->webhooks()->event()->settings()->get(); |
| 292 | - print $response->statusCode() . "\n"; |
|
| 292 | + print $response->statusCode()."\n"; |
|
| 293 | 293 | print_r($response->headers()); |
| 294 | - print $response->body() . "\n"; |
|
| 294 | + print $response->body()."\n"; |
|
| 295 | 295 | } catch (Exception $e) { |
| 296 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 296 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | //////////////////////////////////////////////////// |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | try { |
| 308 | 308 | $response = $sg->client->user()->webhooks()->event()->test()->post($request_body); |
| 309 | - print $response->statusCode() . "\n"; |
|
| 309 | + print $response->statusCode()."\n"; |
|
| 310 | 310 | print_r($response->headers()); |
| 311 | - print $response->body() . "\n"; |
|
| 311 | + print $response->body()."\n"; |
|
| 312 | 312 | } catch (Exception $e) { |
| 313 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 313 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | //////////////////////////////////////////////////// |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | try { |
| 328 | 328 | $response = $sg->client->user()->webhooks()->parse()->settings()->post($request_body); |
| 329 | - print $response->statusCode() . "\n"; |
|
| 329 | + print $response->statusCode()."\n"; |
|
| 330 | 330 | print_r($response->headers()); |
| 331 | - print $response->body() . "\n"; |
|
| 331 | + print $response->body()."\n"; |
|
| 332 | 332 | } catch (Exception $e) { |
| 333 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 333 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | //////////////////////////////////////////////////// |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | try { |
| 341 | 341 | $response = $sg->client->user()->webhooks()->parse()->settings()->get(); |
| 342 | - print $response->statusCode() . "\n"; |
|
| 342 | + print $response->statusCode()."\n"; |
|
| 343 | 343 | print_r($response->headers()); |
| 344 | - print $response->body() . "\n"; |
|
| 344 | + print $response->body()."\n"; |
|
| 345 | 345 | } catch (Exception $e) { |
| 346 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 346 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | //////////////////////////////////////////////////// |
@@ -359,11 +359,11 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | try { |
| 361 | 361 | $response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->patch($request_body); |
| 362 | - print $response->statusCode() . "\n"; |
|
| 362 | + print $response->statusCode()."\n"; |
|
| 363 | 363 | print_r($response->headers()); |
| 364 | - print $response->body() . "\n"; |
|
| 364 | + print $response->body()."\n"; |
|
| 365 | 365 | } catch (Exception $e) { |
| 366 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 366 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | //////////////////////////////////////////////////// |
@@ -374,11 +374,11 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | try { |
| 376 | 376 | $response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->get(); |
| 377 | - print $response->statusCode() . "\n"; |
|
| 377 | + print $response->statusCode()."\n"; |
|
| 378 | 378 | print_r($response->headers()); |
| 379 | - print $response->body() . "\n"; |
|
| 379 | + print $response->body()."\n"; |
|
| 380 | 380 | } catch (Exception $e) { |
| 381 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 381 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | //////////////////////////////////////////////////// |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | try { |
| 391 | 391 | $response = $sg->client->user()->webhooks()->parse()->settings()->_($hostname)->delete(); |
| 392 | - print $response->statusCode() . "\n"; |
|
| 392 | + print $response->statusCode()."\n"; |
|
| 393 | 393 | print_r($response->headers()); |
| 394 | - print $response->body() . "\n"; |
|
| 394 | + print $response->body()."\n"; |
|
| 395 | 395 | } catch (Exception $e) { |
| 396 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 396 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | //////////////////////////////////////////////////// |
@@ -404,9 +404,9 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | try { |
| 406 | 406 | $response = $sg->client->user()->webhooks()->parse()->stats()->get(null, $query_params); |
| 407 | - print $response->statusCode() . "\n"; |
|
| 407 | + print $response->statusCode()."\n"; |
|
| 408 | 408 | print_r($response->headers()); |
| 409 | - print $response->body() . "\n"; |
|
| 409 | + print $response->body()."\n"; |
|
| 410 | 410 | } catch (Exception $e) { |
| 411 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 411 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 412 | 412 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | $apiKey = getenv('SENDGRID_API_KEY'); |
| 8 | 8 | $sg = new \SendGrid($apiKey); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | use SendGrid\Mail\To; |
| 8 | 8 | use SendGrid\Mail\Cc; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $asm = new ASM(); |
| 150 | 150 | $asm->setGroupId(99); |
| 151 | - $asm->setGroupsToDisplay([4,5,6,7,8]); |
|
| 151 | + $asm->setGroupsToDisplay([4, 5, 6, 7, 8]); |
|
| 152 | 152 | $mail->setASM($asm); |
| 153 | 153 | |
| 154 | 154 | $mail->setIpPoolName("23"); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | //echo json_encode($mail, JSON_PRETTY_PRINT), "\n"; |
| 219 | 219 | return $mail; |
| 220 | 220 | } catch (\Exception $e) { |
| 221 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 221 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | return null; |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | try { |
| 240 | 240 | $response = $sg->client->mail()->send()->post($request_body); |
| 241 | - print $response->statusCode() . "\n"; |
|
| 241 | + print $response->statusCode()."\n"; |
|
| 242 | 242 | print_r($response->headers()); |
| 243 | - print $response->body() . "\n"; |
|
| 243 | + print $response->body()."\n"; |
|
| 244 | 244 | } catch (\Exception $e) { |
| 245 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 245 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | try { |
| 262 | 262 | $response = $sg->client->mail()->send()->post($request_body); |
| 263 | - print $response->statusCode() . "\n"; |
|
| 263 | + print $response->statusCode()."\n"; |
|
| 264 | 264 | print_r($response->headers()); |
| 265 | - print $response->body() . "\n"; |
|
| 265 | + print $response->body()."\n"; |
|
| 266 | 266 | } catch (\Exception $e) { |
| 267 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 267 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | -sendHelloEmail(); // this will actually send an email |
|
| 271 | +sendHelloEmail(); // this will actually send an email |
|
| 272 | 272 | sendKitchenSink(); // this will only send an email if you set SandBox Mode to false |
@@ -2,14 +2,14 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | // This will build an HTML form to be embedded in your page. |
| 8 | 8 | // This form allows users to subscribe using their name and email. |
| 9 | 9 | function buildRecipientForm($url = 'http://www.example.com/recipientFormSubmit') |
| 10 | 10 | { |
| 11 | 11 | $form = (string) new \SendGrid\Contacts\RecipientForm($url); |
| 12 | - echo $form . PHP_EOL; |
|
| 12 | + echo $form.PHP_EOL; |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | // This will accept a form submission from the above form. Will create a new Recipient, |
@@ -34,20 +34,20 @@ discard block |
||
| 34 | 34 | $request_body = json_decode( |
| 35 | 35 | '[ |
| 36 | 36 | { |
| 37 | - "email": "' . $recipient->getEmail() . '", |
|
| 38 | - "first_name": "' . $recipient->getFirstName() . '", |
|
| 39 | - "last_name": "' . $recipient->getLastName() . '" |
|
| 37 | + "email": "' . $recipient->getEmail().'", |
|
| 38 | + "first_name": "' . $recipient->getFirstName().'", |
|
| 39 | + "last_name": "' . $recipient->getLastName().'" |
|
| 40 | 40 | } |
| 41 | 41 | ]' |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | try { |
| 45 | 45 | $response = $sg->client->contactdb()->recipients()->post($request_body); |
| 46 | - print $response->statusCode() . "\n"; |
|
| 46 | + print $response->statusCode()."\n"; |
|
| 47 | 47 | print_r($response->headers()); |
| 48 | - print $response->body() . "\n"; |
|
| 48 | + print $response->body()."\n"; |
|
| 49 | 49 | } catch (Exception $e) { |
| 50 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 50 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | $apiKey = getenv('SENDGRID_API_KEY'); |
| 8 | 8 | $sg = new \SendGrid($apiKey); |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | try { |
| 21 | 21 | $response = $sg->client->alerts()->post($request_body); |
| 22 | - print $response->statusCode() . "\n"; |
|
| 22 | + print $response->statusCode()."\n"; |
|
| 23 | 23 | print_r($response->headers()); |
| 24 | - print $response->body() . "\n"; |
|
| 24 | + print $response->body()."\n"; |
|
| 25 | 25 | } catch (Exception $e) { |
| 26 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 26 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | //////////////////////////////////////////////////// |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | $response = $sg->client->alerts()->get(); |
| 35 | - print $response->statusCode() . "\n"; |
|
| 35 | + print $response->statusCode()."\n"; |
|
| 36 | 36 | print_r($response->headers()); |
| 37 | - print $response->body() . "\n"; |
|
| 37 | + print $response->body()."\n"; |
|
| 38 | 38 | } catch (Exception $e) { |
| 39 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 39 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | //////////////////////////////////////////////////// |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | try { |
| 52 | 52 | $response = $sg->client->alerts()->_($alert_id)->patch($request_body); |
| 53 | - print $response->statusCode() . "\n"; |
|
| 53 | + print $response->statusCode()."\n"; |
|
| 54 | 54 | print_r($response->headers()); |
| 55 | - print $response->body() . "\n"; |
|
| 55 | + print $response->body()."\n"; |
|
| 56 | 56 | } catch (Exception $e) { |
| 57 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 57 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | //////////////////////////////////////////////////// |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | try { |
| 67 | 67 | $response = $sg->client->alerts()->_($alert_id)->get(); |
| 68 | - print $response->statusCode() . "\n"; |
|
| 68 | + print $response->statusCode()."\n"; |
|
| 69 | 69 | print_r($response->headers()); |
| 70 | - print $response->body() . "\n"; |
|
| 70 | + print $response->body()."\n"; |
|
| 71 | 71 | } catch (Exception $e) { |
| 72 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 72 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | //////////////////////////////////////////////////// |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | try { |
| 82 | 82 | $response = $sg->client->alerts()->_($alert_id)->delete(); |
| 83 | - print $response->statusCode() . "\n"; |
|
| 83 | + print $response->statusCode()."\n"; |
|
| 84 | 84 | print_r($response->headers()); |
| 85 | - print $response->body() . "\n"; |
|
| 85 | + print $response->body()."\n"; |
|
| 86 | 86 | } catch (Exception $e) { |
| 87 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 87 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 88 | 88 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | $apiKey = getenv('SENDGRID_API_KEY'); |
| 8 | 8 | $sg = new \SendGrid($apiKey); |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | try { |
| 19 | 19 | $response = $sg->client->templates()->post($request_body); |
| 20 | - print $response->statusCode() . "\n"; |
|
| 20 | + print $response->statusCode()."\n"; |
|
| 21 | 21 | print_r($response->headers()); |
| 22 | - print $response->body() . "\n"; |
|
| 22 | + print $response->body()."\n"; |
|
| 23 | 23 | } catch (Exception $e) { |
| 24 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 24 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | //////////////////////////////////////////////////// |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | $response = $sg->client->templates()->get(null, $query_params); |
| 35 | - print $response->statusCode() . "\n"; |
|
| 35 | + print $response->statusCode()."\n"; |
|
| 36 | 36 | print_r($response->headers()); |
| 37 | - print $response->body() . "\n"; |
|
| 37 | + print $response->body()."\n"; |
|
| 38 | 38 | } catch (Exception $e) { |
| 39 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 39 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | //////////////////////////////////////////////////// |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | try { |
| 52 | 52 | $response = $sg->client->templates()->_($template_id)->patch($request_body); |
| 53 | - print $response->statusCode() . "\n"; |
|
| 53 | + print $response->statusCode()."\n"; |
|
| 54 | 54 | print_r($response->headers()); |
| 55 | - print $response->body() . "\n"; |
|
| 55 | + print $response->body()."\n"; |
|
| 56 | 56 | } catch (Exception $e) { |
| 57 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 57 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | //////////////////////////////////////////////////// |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | try { |
| 67 | 67 | $response = $sg->client->templates()->_($template_id)->get(); |
| 68 | - print $response->statusCode() . "\n"; |
|
| 68 | + print $response->statusCode()."\n"; |
|
| 69 | 69 | print_r($response->headers()); |
| 70 | - print $response->body() . "\n"; |
|
| 70 | + print $response->body()."\n"; |
|
| 71 | 71 | } catch (Exception $e) { |
| 72 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 72 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | //////////////////////////////////////////////////// |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | try { |
| 82 | 82 | $response = $sg->client->templates()->_($template_id)->delete(); |
| 83 | - print $response->statusCode() . "\n"; |
|
| 83 | + print $response->statusCode()."\n"; |
|
| 84 | 84 | print_r($response->headers()); |
| 85 | - print $response->body() . "\n"; |
|
| 85 | + print $response->body()."\n"; |
|
| 86 | 86 | } catch (Exception $e) { |
| 87 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 87 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | //////////////////////////////////////////////////// |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | try { |
| 105 | 105 | $response = $sg->client->templates()->_($template_id)->versions()->post($request_body); |
| 106 | - print $response->statusCode() . "\n"; |
|
| 106 | + print $response->statusCode()."\n"; |
|
| 107 | 107 | print_r($response->headers()); |
| 108 | - print $response->body() . "\n"; |
|
| 108 | + print $response->body()."\n"; |
|
| 109 | 109 | } catch (Exception $e) { |
| 110 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 110 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | //////////////////////////////////////////////////// |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | try { |
| 128 | 128 | $response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->patch($request_body); |
| 129 | - print $response->statusCode() . "\n"; |
|
| 129 | + print $response->statusCode()."\n"; |
|
| 130 | 130 | print_r($response->headers()); |
| 131 | - print $response->body() . "\n"; |
|
| 131 | + print $response->body()."\n"; |
|
| 132 | 132 | } catch (Exception $e) { |
| 133 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 133 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | //////////////////////////////////////////////////// |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | try { |
| 144 | 144 | $response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->get(); |
| 145 | - print $response->statusCode() . "\n"; |
|
| 145 | + print $response->statusCode()."\n"; |
|
| 146 | 146 | print_r($response->headers()); |
| 147 | - print $response->body() . "\n"; |
|
| 147 | + print $response->body()."\n"; |
|
| 148 | 148 | } catch (Exception $e) { |
| 149 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 149 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | //////////////////////////////////////////////////// |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | try { |
| 160 | 160 | $response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->delete(); |
| 161 | - print $response->statusCode() . "\n"; |
|
| 161 | + print $response->statusCode()."\n"; |
|
| 162 | 162 | print_r($response->headers()); |
| 163 | - print $response->body() . "\n"; |
|
| 163 | + print $response->body()."\n"; |
|
| 164 | 164 | } catch (Exception $e) { |
| 165 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 165 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | //////////////////////////////////////////////////// |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | try { |
| 176 | 176 | $response = $sg->client->templates()->_($template_id)->versions()->_($version_id)->activate()->post(); |
| 177 | - print $response->statusCode() . "\n"; |
|
| 177 | + print $response->statusCode()."\n"; |
|
| 178 | 178 | print_r($response->headers()); |
| 179 | - print $response->body() . "\n"; |
|
| 179 | + print $response->body()."\n"; |
|
| 180 | 180 | } catch (Exception $e) { |
| 181 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 181 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 182 | 182 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | $apiKey = getenv('SENDGRID_API_KEY'); |
| 8 | 8 | $sg = new \SendGrid($apiKey); |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | try { |
| 20 | 20 | $response = $sg->client->contactdb()->custom_fields()->post($request_body); |
| 21 | - print $response->statusCode() . "\n"; |
|
| 21 | + print $response->statusCode()."\n"; |
|
| 22 | 22 | print_r($response->headers()); |
| 23 | - print $response->body() . "\n"; |
|
| 23 | + print $response->body()."\n"; |
|
| 24 | 24 | } catch (Exception $e) { |
| 25 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 25 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | //////////////////////////////////////////////////// |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | try { |
| 33 | 33 | $response = $sg->client->contactdb()->custom_fields()->get(); |
| 34 | - print $response->statusCode() . "\n"; |
|
| 34 | + print $response->statusCode()."\n"; |
|
| 35 | 35 | print_r($response->headers()); |
| 36 | - print $response->body() . "\n"; |
|
| 36 | + print $response->body()."\n"; |
|
| 37 | 37 | } catch (Exception $e) { |
| 38 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 38 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | //////////////////////////////////////////////////// |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | try { |
| 48 | 48 | $response = $sg->client->contactdb()->custom_fields()->_($custom_field_id)->get(); |
| 49 | - print $response->statusCode() . "\n"; |
|
| 49 | + print $response->statusCode()."\n"; |
|
| 50 | 50 | print_r($response->headers()); |
| 51 | - print $response->body() . "\n"; |
|
| 51 | + print $response->body()."\n"; |
|
| 52 | 52 | } catch (Exception $e) { |
| 53 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 53 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | //////////////////////////////////////////////////// |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | try { |
| 63 | 63 | $response = $sg->client->contactdb()->custom_fields()->_($custom_field_id)->delete(); |
| 64 | - print $response->statusCode() . "\n"; |
|
| 64 | + print $response->statusCode()."\n"; |
|
| 65 | 65 | print_r($response->headers()); |
| 66 | - print $response->body() . "\n"; |
|
| 66 | + print $response->body()."\n"; |
|
| 67 | 67 | } catch (Exception $e) { |
| 68 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 68 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | //////////////////////////////////////////////////// |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | try { |
| 80 | 80 | $response = $sg->client->contactdb()->lists()->post($request_body); |
| 81 | - print $response->statusCode() . "\n"; |
|
| 81 | + print $response->statusCode()."\n"; |
|
| 82 | 82 | print_r($response->headers()); |
| 83 | - print $response->body() . "\n"; |
|
| 83 | + print $response->body()."\n"; |
|
| 84 | 84 | } catch (Exception $e) { |
| 85 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 85 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | //////////////////////////////////////////////////// |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | try { |
| 93 | 93 | $response = $sg->client->contactdb()->lists()->get(); |
| 94 | - print $response->statusCode() . "\n"; |
|
| 94 | + print $response->statusCode()."\n"; |
|
| 95 | 95 | print_r($response->headers()); |
| 96 | - print $response->body() . "\n"; |
|
| 96 | + print $response->body()."\n"; |
|
| 97 | 97 | } catch (Exception $e) { |
| 98 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 98 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | //////////////////////////////////////////////////// |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | try { |
| 113 | 113 | $response = $sg->client->contactdb()->lists()->delete($request_body); |
| 114 | - print $response->statusCode() . "\n"; |
|
| 114 | + print $response->statusCode()."\n"; |
|
| 115 | 115 | print_r($response->headers()); |
| 116 | - print $response->body() . "\n"; |
|
| 116 | + print $response->body()."\n"; |
|
| 117 | 117 | } catch (Exception $e) { |
| 118 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 118 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | //////////////////////////////////////////////////// |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | try { |
| 132 | 132 | $response = $sg->client->contactdb()->lists()->_($list_id)->patch($request_body, $query_params); |
| 133 | - print $response->statusCode() . "\n"; |
|
| 133 | + print $response->statusCode()."\n"; |
|
| 134 | 134 | print_r($response->headers()); |
| 135 | - print $response->body() . "\n"; |
|
| 135 | + print $response->body()."\n"; |
|
| 136 | 136 | } catch (Exception $e) { |
| 137 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 137 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | //////////////////////////////////////////////////// |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | try { |
| 148 | 148 | $response = $sg->client->contactdb()->lists()->_($list_id)->get(null, $query_params); |
| 149 | - print $response->statusCode() . "\n"; |
|
| 149 | + print $response->statusCode()."\n"; |
|
| 150 | 150 | print_r($response->headers()); |
| 151 | - print $response->body() . "\n"; |
|
| 151 | + print $response->body()."\n"; |
|
| 152 | 152 | } catch (Exception $e) { |
| 153 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 153 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | //////////////////////////////////////////////////// |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | try { |
| 164 | 164 | $response = $sg->client->contactdb()->lists()->_($list_id)->delete(null, $query_params); |
| 165 | - print $response->statusCode() . "\n"; |
|
| 165 | + print $response->statusCode()."\n"; |
|
| 166 | 166 | print_r($response->headers()); |
| 167 | - print $response->body() . "\n"; |
|
| 167 | + print $response->body()."\n"; |
|
| 168 | 168 | } catch (Exception $e) { |
| 169 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 169 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | //////////////////////////////////////////////////// |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | try { |
| 183 | 183 | $response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->post($request_body); |
| 184 | - print $response->statusCode() . "\n"; |
|
| 184 | + print $response->statusCode()."\n"; |
|
| 185 | 185 | print_r($response->headers()); |
| 186 | - print $response->body() . "\n"; |
|
| 186 | + print $response->body()."\n"; |
|
| 187 | 187 | } catch (Exception $e) { |
| 188 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 188 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | //////////////////////////////////////////////////// |
@@ -197,11 +197,11 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | try { |
| 199 | 199 | $response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->get(null, $query_params); |
| 200 | - print $response->statusCode() . "\n"; |
|
| 200 | + print $response->statusCode()."\n"; |
|
| 201 | 201 | print_r($response->headers()); |
| 202 | - print $response->body() . "\n"; |
|
| 202 | + print $response->body()."\n"; |
|
| 203 | 203 | } catch (Exception $e) { |
| 204 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 204 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | //////////////////////////////////////////////////// |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | try { |
| 215 | 215 | $response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->post(); |
| 216 | - print $response->statusCode() . "\n"; |
|
| 216 | + print $response->statusCode()."\n"; |
|
| 217 | 217 | print_r($response->headers()); |
| 218 | - print $response->body() . "\n"; |
|
| 218 | + print $response->body()."\n"; |
|
| 219 | 219 | } catch (Exception $e) { |
| 220 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 220 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | //////////////////////////////////////////////////// |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | try { |
| 232 | 232 | $response = $sg->client->contactdb()->lists()->_($list_id)->recipients()->_($recipient_id)->delete(null, $query_params); |
| 233 | - print $response->statusCode() . "\n"; |
|
| 233 | + print $response->statusCode()."\n"; |
|
| 234 | 234 | print_r($response->headers()); |
| 235 | - print $response->body() . "\n"; |
|
| 235 | + print $response->body()."\n"; |
|
| 236 | 236 | } catch (Exception $e) { |
| 237 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 237 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | //////////////////////////////////////////////////// |
@@ -251,11 +251,11 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | try { |
| 253 | 253 | $response = $sg->client->contactdb()->recipients()->patch($request_body); |
| 254 | - print $response->statusCode() . "\n"; |
|
| 254 | + print $response->statusCode()."\n"; |
|
| 255 | 255 | print_r($response->headers()); |
| 256 | - print $response->body() . "\n"; |
|
| 256 | + print $response->body()."\n"; |
|
| 257 | 257 | } catch (Exception $e) { |
| 258 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 258 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | //////////////////////////////////////////////////// |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | try { |
| 281 | 281 | $response = $sg->client->contactdb()->recipients()->post($request_body); |
| 282 | - print $response->statusCode() . "\n"; |
|
| 282 | + print $response->statusCode()."\n"; |
|
| 283 | 283 | print_r($response->headers()); |
| 284 | - print $response->body() . "\n"; |
|
| 284 | + print $response->body()."\n"; |
|
| 285 | 285 | } catch (Exception $e) { |
| 286 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 286 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | //////////////////////////////////////////////////// |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | try { |
| 296 | 296 | $response = $sg->client->contactdb()->recipients()->get(null, $query_params); |
| 297 | - print $response->statusCode() . "\n"; |
|
| 297 | + print $response->statusCode()."\n"; |
|
| 298 | 298 | print_r($response->headers()); |
| 299 | - print $response->body() . "\n"; |
|
| 299 | + print $response->body()."\n"; |
|
| 300 | 300 | } catch (Exception $e) { |
| 301 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 301 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | //////////////////////////////////////////////////// |
@@ -312,11 +312,11 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | try { |
| 314 | 314 | $response = $sg->client->contactdb()->recipients()->delete($request_body); |
| 315 | - print $response->statusCode() . "\n"; |
|
| 315 | + print $response->statusCode()."\n"; |
|
| 316 | 316 | print_r($response->headers()); |
| 317 | - print $response->body() . "\n"; |
|
| 317 | + print $response->body()."\n"; |
|
| 318 | 318 | } catch (Exception $e) { |
| 319 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 319 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | //////////////////////////////////////////////////// |
@@ -325,11 +325,11 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | try { |
| 327 | 327 | $response = $sg->client->contactdb()->recipients()->billable_count()->get(); |
| 328 | - print $response->statusCode() . "\n"; |
|
| 328 | + print $response->statusCode()."\n"; |
|
| 329 | 329 | print_r($response->headers()); |
| 330 | - print $response->body() . "\n"; |
|
| 330 | + print $response->body()."\n"; |
|
| 331 | 331 | } catch (Exception $e) { |
| 332 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 332 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | //////////////////////////////////////////////////// |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | try { |
| 340 | 340 | $response = $sg->client->contactdb()->recipients()->count()->get(); |
| 341 | - print $response->statusCode() . "\n"; |
|
| 341 | + print $response->statusCode()."\n"; |
|
| 342 | 342 | print_r($response->headers()); |
| 343 | - print $response->body() . "\n"; |
|
| 343 | + print $response->body()."\n"; |
|
| 344 | 344 | } catch (Exception $e) { |
| 345 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 345 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | //////////////////////////////////////////////////// |
@@ -353,11 +353,11 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | try { |
| 355 | 355 | $response = $sg->client->contactdb()->recipients()->search()->get(null, $query_params); |
| 356 | - print $response->statusCode() . "\n"; |
|
| 356 | + print $response->statusCode()."\n"; |
|
| 357 | 357 | print_r($response->headers()); |
| 358 | - print $response->body() . "\n"; |
|
| 358 | + print $response->body()."\n"; |
|
| 359 | 359 | } catch (Exception $e) { |
| 360 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 360 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | //////////////////////////////////////////////////// |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | try { |
| 370 | 370 | $response = $sg->client->contactdb()->recipients()->_($recipient_id)->get(); |
| 371 | - print $response->statusCode() . "\n"; |
|
| 371 | + print $response->statusCode()."\n"; |
|
| 372 | 372 | print_r($response->headers()); |
| 373 | - print $response->body() . "\n"; |
|
| 373 | + print $response->body()."\n"; |
|
| 374 | 374 | } catch (Exception $e) { |
| 375 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 375 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | //////////////////////////////////////////////////// |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | try { |
| 385 | 385 | $response = $sg->client->contactdb()->recipients()->_($recipient_id)->delete(); |
| 386 | - print $response->statusCode() . "\n"; |
|
| 386 | + print $response->statusCode()."\n"; |
|
| 387 | 387 | print_r($response->headers()); |
| 388 | - print $response->body() . "\n"; |
|
| 388 | + print $response->body()."\n"; |
|
| 389 | 389 | } catch (Exception $e) { |
| 390 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 390 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | //////////////////////////////////////////////////// |
@@ -398,11 +398,11 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | try { |
| 400 | 400 | $response = $sg->client->contactdb()->recipients()->_($recipient_id)->lists()->get(); |
| 401 | - print $response->statusCode() . "\n"; |
|
| 401 | + print $response->statusCode()."\n"; |
|
| 402 | 402 | print_r($response->headers()); |
| 403 | - print $response->body() . "\n"; |
|
| 403 | + print $response->body()."\n"; |
|
| 404 | 404 | } catch (Exception $e) { |
| 405 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 405 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | //////////////////////////////////////////////////// |
@@ -411,11 +411,11 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | try { |
| 413 | 413 | $response = $sg->client->contactdb()->reserved_fields()->get(); |
| 414 | - print $response->statusCode() . "\n"; |
|
| 414 | + print $response->statusCode()."\n"; |
|
| 415 | 415 | print_r($response->headers()); |
| 416 | - print $response->body() . "\n"; |
|
| 416 | + print $response->body()."\n"; |
|
| 417 | 417 | } catch (Exception $e) { |
| 418 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 418 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | //////////////////////////////////////////////////// |
@@ -449,11 +449,11 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | try { |
| 451 | 451 | $response = $sg->client->contactdb()->segments()->post($request_body); |
| 452 | - print $response->statusCode() . "\n"; |
|
| 452 | + print $response->statusCode()."\n"; |
|
| 453 | 453 | print_r($response->headers()); |
| 454 | - print $response->body() . "\n"; |
|
| 454 | + print $response->body()."\n"; |
|
| 455 | 455 | } catch (Exception $e) { |
| 456 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 456 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | //////////////////////////////////////////////////// |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | try { |
| 464 | 464 | $response = $sg->client->contactdb()->segments()->get(); |
| 465 | - print $response->statusCode() . "\n"; |
|
| 465 | + print $response->statusCode()."\n"; |
|
| 466 | 466 | print_r($response->headers()); |
| 467 | - print $response->body() . "\n"; |
|
| 467 | + print $response->body()."\n"; |
|
| 468 | 468 | } catch (Exception $e) { |
| 469 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 469 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | //////////////////////////////////////////////////// |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | try { |
| 492 | 492 | $response = $sg->client->contactdb()->segments()->_($segment_id)->patch($request_body, $query_params); |
| 493 | - print $response->statusCode() . "\n"; |
|
| 493 | + print $response->statusCode()."\n"; |
|
| 494 | 494 | print_r($response->headers()); |
| 495 | - print $response->body() . "\n"; |
|
| 495 | + print $response->body()."\n"; |
|
| 496 | 496 | } catch (Exception $e) { |
| 497 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 497 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | //////////////////////////////////////////////////// |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | try { |
| 508 | 508 | $response = $sg->client->contactdb()->segments()->_($segment_id)->get(null, $query_params); |
| 509 | - print $response->statusCode() . "\n"; |
|
| 509 | + print $response->statusCode()."\n"; |
|
| 510 | 510 | print_r($response->headers()); |
| 511 | - print $response->body() . "\n"; |
|
| 511 | + print $response->body()."\n"; |
|
| 512 | 512 | } catch (Exception $e) { |
| 513 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 513 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | //////////////////////////////////////////////////// |
@@ -522,11 +522,11 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | try { |
| 524 | 524 | $response = $sg->client->contactdb()->segments()->_($segment_id)->delete(null, $query_params); |
| 525 | - print $response->statusCode() . "\n"; |
|
| 525 | + print $response->statusCode()."\n"; |
|
| 526 | 526 | print_r($response->headers()); |
| 527 | - print $response->body() . "\n"; |
|
| 527 | + print $response->body()."\n"; |
|
| 528 | 528 | } catch (Exception $e) { |
| 529 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 529 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | //////////////////////////////////////////////////// |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | try { |
| 540 | 540 | $response = $sg->client->contactdb()->segments()->_($segment_id)->recipients()->get(null, $query_params); |
| 541 | - print $response->statusCode() . "\n"; |
|
| 541 | + print $response->statusCode()."\n"; |
|
| 542 | 542 | print_r($response->headers()); |
| 543 | - print $response->body() . "\n"; |
|
| 543 | + print $response->body()."\n"; |
|
| 544 | 544 | } catch (Exception $e) { |
| 545 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 545 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 546 | 546 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Next line will load dependencies to run this example |
| 4 | 4 | // Please refer to the README how to use in your project |
| 5 | -require_once __DIR__ . '/../../sendgrid-php.php'; |
|
| 5 | +require_once __DIR__.'/../../sendgrid-php.php'; |
|
| 6 | 6 | |
| 7 | 7 | $apiKey = getenv('SENDGRID_API_KEY'); |
| 8 | 8 | $sg = new \SendGrid($apiKey); |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | try { |
| 17 | 17 | $response = $sg->client->ips()->get(null, $query_params); |
| 18 | - print $response->statusCode() . "\n"; |
|
| 18 | + print $response->statusCode()."\n"; |
|
| 19 | 19 | print_r($response->headers()); |
| 20 | - print $response->body() . "\n"; |
|
| 20 | + print $response->body()."\n"; |
|
| 21 | 21 | } catch (Exception $e) { |
| 22 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 22 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | //////////////////////////////////////////////////// |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | try { |
| 30 | 30 | $response = $sg->client->ips()->assigned()->get(); |
| 31 | - print $response->statusCode() . "\n"; |
|
| 31 | + print $response->statusCode()."\n"; |
|
| 32 | 32 | print_r($response->headers()); |
| 33 | - print $response->body() . "\n"; |
|
| 33 | + print $response->body()."\n"; |
|
| 34 | 34 | } catch (Exception $e) { |
| 35 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 35 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | //////////////////////////////////////////////////// |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | try { |
| 47 | 47 | $response = $sg->client->ips()->pools()->post($request_body); |
| 48 | - print $response->statusCode() . "\n"; |
|
| 48 | + print $response->statusCode()."\n"; |
|
| 49 | 49 | print_r($response->headers()); |
| 50 | - print $response->body() . "\n"; |
|
| 50 | + print $response->body()."\n"; |
|
| 51 | 51 | } catch (Exception $e) { |
| 52 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 52 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //////////////////////////////////////////////////// |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | try { |
| 60 | 60 | $response = $sg->client->ips()->pools()->get(); |
| 61 | - print $response->statusCode() . "\n"; |
|
| 61 | + print $response->statusCode()."\n"; |
|
| 62 | 62 | print_r($response->headers()); |
| 63 | - print $response->body() . "\n"; |
|
| 63 | + print $response->body()."\n"; |
|
| 64 | 64 | } catch (Exception $e) { |
| 65 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 65 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | //////////////////////////////////////////////////// |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | try { |
| 78 | 78 | $response = $sg->client->ips()->pools()->_($pool_name)->put($request_body); |
| 79 | - print $response->statusCode() . "\n"; |
|
| 79 | + print $response->statusCode()."\n"; |
|
| 80 | 80 | print_r($response->headers()); |
| 81 | - print $response->body() . "\n"; |
|
| 81 | + print $response->body()."\n"; |
|
| 82 | 82 | } catch (Exception $e) { |
| 83 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 83 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | //////////////////////////////////////////////////// |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | try { |
| 93 | 93 | $response = $sg->client->ips()->pools()->_($pool_name)->get(); |
| 94 | - print $response->statusCode() . "\n"; |
|
| 94 | + print $response->statusCode()."\n"; |
|
| 95 | 95 | print_r($response->headers()); |
| 96 | - print $response->body() . "\n"; |
|
| 96 | + print $response->body()."\n"; |
|
| 97 | 97 | } catch (Exception $e) { |
| 98 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 98 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | //////////////////////////////////////////////////// |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | try { |
| 108 | 108 | $response = $sg->client->ips()->pools()->_($pool_name)->delete(); |
| 109 | - print $response->statusCode() . "\n"; |
|
| 109 | + print $response->statusCode()."\n"; |
|
| 110 | 110 | print_r($response->headers()); |
| 111 | - print $response->body() . "\n"; |
|
| 111 | + print $response->body()."\n"; |
|
| 112 | 112 | } catch (Exception $e) { |
| 113 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 113 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | //////////////////////////////////////////////////// |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | try { |
| 126 | 126 | $response = $sg->client->ips()->pools()->_($pool_name)->ips()->post($request_body); |
| 127 | - print $response->statusCode() . "\n"; |
|
| 127 | + print $response->statusCode()."\n"; |
|
| 128 | 128 | print_r($response->headers()); |
| 129 | - print $response->body() . "\n"; |
|
| 129 | + print $response->body()."\n"; |
|
| 130 | 130 | } catch (Exception $e) { |
| 131 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 131 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | //////////////////////////////////////////////////// |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | try { |
| 142 | 142 | $response = $sg->client->ips()->pools()->_($pool_name)->ips()->_($ip)->delete(); |
| 143 | - print $response->statusCode() . "\n"; |
|
| 143 | + print $response->statusCode()."\n"; |
|
| 144 | 144 | print_r($response->headers()); |
| 145 | - print $response->body() . "\n"; |
|
| 145 | + print $response->body()."\n"; |
|
| 146 | 146 | } catch (Exception $e) { |
| 147 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 147 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | //////////////////////////////////////////////////// |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | try { |
| 159 | 159 | $response = $sg->client->ips()->warmup()->post($request_body); |
| 160 | - print $response->statusCode() . "\n"; |
|
| 160 | + print $response->statusCode()."\n"; |
|
| 161 | 161 | print_r($response->headers()); |
| 162 | - print $response->body() . "\n"; |
|
| 162 | + print $response->body()."\n"; |
|
| 163 | 163 | } catch (Exception $e) { |
| 164 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 164 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | //////////////////////////////////////////////////// |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | try { |
| 172 | 172 | $response = $sg->client->ips()->warmup()->get(); |
| 173 | - print $response->statusCode() . "\n"; |
|
| 173 | + print $response->statusCode()."\n"; |
|
| 174 | 174 | print_r($response->headers()); |
| 175 | - print $response->body() . "\n"; |
|
| 175 | + print $response->body()."\n"; |
|
| 176 | 176 | } catch (Exception $e) { |
| 177 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 177 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | //////////////////////////////////////////////////// |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | try { |
| 187 | 187 | $response = $sg->client->ips()->warmup()->_($ip_address)->get(); |
| 188 | - print $response->statusCode() . "\n"; |
|
| 188 | + print $response->statusCode()."\n"; |
|
| 189 | 189 | print_r($response->headers()); |
| 190 | - print $response->body() . "\n"; |
|
| 190 | + print $response->body()."\n"; |
|
| 191 | 191 | } catch (Exception $e) { |
| 192 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 192 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | //////////////////////////////////////////////////// |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | try { |
| 202 | 202 | $response = $sg->client->ips()->warmup()->_($ip_address)->delete(); |
| 203 | - print $response->statusCode() . "\n"; |
|
| 203 | + print $response->statusCode()."\n"; |
|
| 204 | 204 | print_r($response->headers()); |
| 205 | - print $response->body() . "\n"; |
|
| 205 | + print $response->body()."\n"; |
|
| 206 | 206 | } catch (Exception $e) { |
| 207 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 207 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | //////////////////////////////////////////////////// |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | try { |
| 217 | 217 | $response = $sg->client->ips()->_($ip_address)->get(); |
| 218 | - print $response->statusCode() . "\n"; |
|
| 218 | + print $response->statusCode()."\n"; |
|
| 219 | 219 | print_r($response->headers()); |
| 220 | - print $response->body() . "\n"; |
|
| 220 | + print $response->body()."\n"; |
|
| 221 | 221 | } catch (Exception $e) { |
| 222 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 222 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 223 | 223 | } |