Last active
May 12, 2019 18:01
-
-
Save ashutoshbarthwal/39f0f82a83a24543ecdaea14bd0c0a6a to your computer and use it in GitHub Desktop.
Owney how to use with php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => "owneymail.com/api/v1/owney/go", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 30, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => "POST", | |
CURLOPT_POSTFIELDS => '{ | |
"templateCode": "WELCOME", | |
"content": { | |
"title" : "John Doe", | |
"hero" : "https://colorlib.com/etc/email-template/1/images/bg_1.jpg" | |
}, | |
"from": "hi@owneymail.com", | |
"to": ["noreply@johnDoe.com"], | |
"cc": ["noreply@johnDoe.com"], | |
"bcc": ["noreply@johnDoe.com"] | |
}', | |
CURLOPT_HTTPHEADER => array( | |
"authorization: Bearer <<YOUR_API_KEY>>", | |
"content-type: application/json" | |
), | |
)); | |
$response = curl_exec($curl); | |
$err = curl_error($curl); | |
curl_close($curl); | |
if ($err) { | |
echo "cURL Error #:" . $err; | |
} else { | |
echo $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment