Very excited to be asking my first question on StackOverflow. I\'ve been relying on it to teach myself quite a lot over the years!
My question is this. I am getting the
You may also want to just use arrays, and let PHP handle the JSON encoding for you. This particular error is common if the JSON is invalid for some reason. So, for example, you could set your parameters like this:
$params = array(
"key" => "keyhere",
"message" => array(
"html" => $content,
"text" => $content_text,
"to" => array(
array("name" => $to, "email" => $to)
),
"from_email" => $from,
"from_name" => $from,
"subject" => $subject,
"track_opens" => true,
"track_clicks" => true
),
"async" => false
);
$postString = json_encode($params);
You can also use json_decode
to parse the response if needed.