diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-03-19 10:51:09 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-03-19 10:51:09 -0700 |
commit | af6fd06aa21cebb7ac601abfc130db137bb705e5 (patch) | |
tree | 71bb76940ec17c9da6435113888ba3898f6122be /examples/example.php | |
parent | 2d1091d3625d0a063880b6f6e616c00c6dd2547d (diff) | |
download | php-http-client-af6fd06aa21cebb7ac601abfc130db137bb705e5.zip php-http-client-af6fd06aa21cebb7ac601abfc130db137bb705e5.tar.gz php-http-client-af6fd06aa21cebb7ac601abfc130db137bb705e5.tar.bz2 |
Added Config
Diffstat (limited to 'examples/example.php')
-rw-r--r-- | examples/example.php | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/example.php b/examples/example.php index 05f0a9a..05fe5eb 100644 --- a/examples/example.php +++ b/examples/example.php @@ -1,11 +1,8 @@ <?php include(dirname(__DIR__).'/php_http_client/client.php'); - -$myfile = fopen(dirname(__DIR__).'/.env', "r"); -$env = fgets($myfile); -$env = explode('=', $env); -$api_key = $env[1]; -$api_key = trim(preg_replace('/\s+/', ' ', $api_key)); +include(dirname(__DIR__).'/php_http_client/config.php'); +$config = new Config(dirname(__DIR__), '.env'); +$api_key = getenv('SENDGRID_API_KEY'); $headers = array( 'Content-Type: application/json', 'Authorization: Bearer '.$api_key |