<!-- Intent: parses the text content and returns an array of text sources --> <?php $url = 'http://api.v4.swiftreach.com/api/Messages/Text/Helpers/TextToSMSSourceObject'; $authToken = '123456'; $jsonString = "This is the body"; $headers = array( 'Content-type: application/json', 'SwiftAPI-Key: ' . $authToken, 'Accept: application/json', 'Expect:' ); $ch = curl_init(); $args = array( CURLOPT_URL => $url, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $jsonString, CURLOPT_HTTPHEADER => $headers, ); curl_setopt_array($ch, $args); $res = curl_exec($ch); $res_data = json_decode($res, true); print($res_data); ?> <!-- Example Return Value --> [{ "$type":"SwiftReach.Swift911.Core.Messages.SMS.SMS_TEXT_SOURCE_TEXT, SwiftReach.Swift911.Core", "Text":"This is the body", "TextType":0 }]