Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEmailsToRecipientList('1234567', 'moron@gmail.com, 'dude');
- function addEmailsToRecipientList($list, $emails, $name){
- $username= 'gmac';
- $password= '1234567';
- $data = array("name" => "$name", "email" => "$email");
- $data_string = json_encode($data);
- $ch = curl_init("https://api.sendgrid.com/v3/contactdb/lists/$list/recipients?api_user='.$username.'&api_key='. $password");
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($data_string))
- );
- $result = curl_exec($ch);
- curl_close($ch);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement