2016-07-07 1 views
1

Où est le fichier sendgrid-php.php que j'ai besoin d'inclure dans mon script pour envoyer du courrier via SendGrid en utilisant la bibliothèque PHP de SendGrid de Github?Où se trouve le fichier sendgrid-php.php dans la bibliothèque PHP de SendGrid?

J'ai téléchargé la bibliothèque PHP de SendGrid de https://github.com/sendgrid/sendgrid-php, et je cherche à inclure sendgrid-php.php dans mon script. Je n'utilise pas Composer.

Mon inclure ressemble:

require("../lib/sendgrid-2016/sendgrid-php.php"); 

$from = new SendGrid\Email(null, "[email protected]"); 
$subject = "Hello World from the SendGrid PHP Library"; 
$to = new SendGrid\Email(null, "[email protected]"); 
$content = new SendGrid\Content("text/plain", "some text here"); 
$mail = new SendGrid\Mail($from, $subject, $to, $content); 

$apiKey = getenv('MY API KEY'); 
$sg = new \SendGrid($apiKey); 

$response = $sg->client->mail()->send()->post($mail); 
echo $response->statusCode(); 
echo $response->headers(); 
echo $response->body(); 

Quand je lance mon script je reçois l'erreur:

Fatal error: require(): Failed opening required '../lib/sendgrid-2016/sendgrid-php.php'

En regardant les fichiers inclus dans le zip sur Github, je ne vois même pas le fichier: file list from github

+0

C'est là que vous placez le répertoire que vous avez téléchargé. C'est définitivement là. Au même niveau que LICENSE.txt et README.md –

Répondre