Read Email Message (get)
<?php
//example PHP code to get an email message
//set values of email message to get
$url_params['apiKey']="APIKEY_HERE";
$url_params['id']="ID_HERE";
$url = 'http://apidomain.com/api8/message';
$url = sprintf("%s?%s", $url, http_build_query($url_params));
//Uses CURL, GET Request
$curl = curl_init($url);
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
echo $result;
//Parse the json to get return values.
$parsed_result = json_decode($result,false);
echo "<br><br>Status: $parsed_result->status";
echo "<br>Message: $parsed_result->message";
echo "<br>Error Code: $parsed_result->errorcode";
echo "<br>Error Message: $parsed_result->errormessage";
echo "<br>Email Message Id: ";
echo $parsed_result->data->id;
echo "<br>Subject:";
echo $parsed_result->data->subject;
echo "<br>Email Name:";
echo $parsed_result->data->emailname;
?>
Comments
0 comments
Article is closed for comments.