PHP mailgun error unexpectedly)

I have the following code based in part on the Mailgun documentation. I am getting this in the error log:

14-Nov-2014 04:21:52 UTC] PHP parse error: syntax error, unexpected ')' in / home / [USERNAME] /public_html/m/FileName.php on line 36

and this is my original code:

<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
date_default_timezone_set('EST');
# Include the Autoloader (see "Libraries" for install instructions)
require 'vendor/autoload.php';
require 'html2text.php';
use Mailgun\Mailgun;
# Instantiate the client.
$mgClient = new Mailgun('[KEY]');
$domain = "[DOMAIN]";
$html = $_POST["message"];
$text = convert_html_to_text($html);
$date = date('l, F jS ');
# Make the call to the client.
$result = $mgClient->sendMessage($domain, array(
    'from'    => '[EMAIL]',
    'to'      => '[EMAIL]',
    'cc'      => '[EMAIL]',
    'subject' => 'New reminder for ' . $date,
    'text'    => 'Hey, ' . "\n" . $text . "\n" . 'More text',
    'html'    => '<html><body>Hey, ' . "\n" . $html . "\n" . 'More Text.</body></html>'
), );
print '<h1>Sent successfully</h1>';
?>

      

Any ideas on what's going on? Line 36 is an array-terminated string.

+3


source to share


2 answers


try to replace

), );

      

to



));

      

remove the comma from the end. there is no need for a comma because you are not passing any more arguments to the function.

0


source


try it



$result = $mgClient->sendMessage($domain, array(
    'from'    => '[EMAIL]',
    'to'      => '[EMAIL]',
    'cc'      => '[EMAIL]',
    'subject' => 'New reminder for ' . $date,
    'text'    => 'Hey, ' . "\n" . $text . "\n" . 'More text',
    'html'    => '<html><body>Hey, ' . "\n" . $html . "\n" . 'More Text.</body></html>'
));

      

0


source







All Articles