new example

This commit is contained in:
4026 2019-08-06 04:57:59 +00:00
parent 610c560eb2
commit 4cedaa54f0

View File

@ -1,21 +1,22 @@
<?php
$post = [
'list' => 23,
'name' => 'Subscriber John',
'email' => 'john@subscriber.aa',
'activated' => 1
];
include "ninjamail.class.php";
$ch = curl_init('http://hirlevel.sandros.eu/a/subscribe?key=f953d4b526fdffda0d58bcd39fbbab29800f31ec8c6bcff53af359cd6528337e5bda05f3faf3f2beef4fb1cc8eeee906be67d6bc7c4b04af61dfc239d6b079e1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
// Mail
$mail = new ninjaMailSend('https://admin.dimail.hu', 'API_KEY');
$mail->to('webmaster@example.org');
$mail->subject('Hello');
$mail->message('HTML_CONTENT', 'TEXT_CONTENT');
var_dump($mail->send());
// execute!
$response = curl_exec($ch);
// Newsletter
$newsletter = new ninjaMailNewsletter('https://admin.dimail.hu', 'API_KEY');
$newsletter->subject('New subject');
$newsletter->message('HTML_CONTENT', 'TEXT_CONTENT OR NULL');
// close the connection
curl_close($ch);
if ($newsletter->update() && $newsletter->send())
echo "updated & sent\n";
// lets see
var_dump($response);
// Stats
$stat = new ninjaMailStatistics('https://admin.dimail.hu', 'API_KEY');
print_r($stat->get(3512201));