Skip to content

Instantly share code, notes, and snippets.

@sebmih
Last active December 20, 2015 04:19
Show Gist options
  • Select an option

  • Save sebmih/6070380 to your computer and use it in GitHub Desktop.

Select an option

Save sebmih/6070380 to your computer and use it in GitHub Desktop.
A working script to schedule a newsletter.
<?php
$url = 'http://sendgrid.com/';
$user = "sebfree";
$pass = "******";
$nl_name = "NLAPI_test3";
$send_time = "2013-07-25T09:00:00+02:00";
$params = array(
'api_user' => $user,
'api_key' => $pass,
'name' => $nl_name,
'at' => $send_time
);
$request = $url.'api/newsletter/schedule/add.json?';
$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
print_r($response);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment