PHP Example
Continuing from the example in Your First Message Template, you can send your transactional message in php with the following.
<?php
$url = "https://txnhog.co/txn/api/your_message_key";
​
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
​
$headers = array(
"Content-Type: application/x-www-form-urlencoded",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
​
$data = "apiKey=sdkrjwhaldkgh3pwdfohawp4lyu&name=Shawn%20Spencer&phone=2085559988";
​
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
​
$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);
?>
Copy link