
Jason Maggard - 2014-01-29 20:11:31
Function: SendAPIRequest
Search for "switch($content_type)"
case 'text/xml':
// Remove all newlines, returns and tabs.
$data = str_replace(array("\n", "\t", "\r"), '', $data);
// Trim leading/trailing spaces, convert dub-quotes to single
$data = trim(str_replace('"', "'", $data));
// Load the string with SimpleXML
$sXml = simplexml_load_string($data);
// Convert to JSON
$response = json_encode($sXml);
break;
It suited my needs. You could just as easily decode the JSON.