function sendToAPI($url, $request = 'GET', $xml = array())
{
    if ($request != "GET") {
        if (substr_count($url, '?') > 0) {
            $url = str_replace('?', '.' . FORMAT . '?', $url);
        } else {
            $url .= '.' . FORMAT;
        }
    } else {
        if (substr_count($url, '?') > 0) {
            $url = str_replace('?', '.xml?', $url);
        } else {
            $url .= '.xml';
        }
    }
    $xml = sizeof($xml) > 0 ? arrayToXML($xml) : false;
    $ch = new miniCURL();
    $data = $ch->send($url, $request, $xml);
    return $ch->loadString($data);
}
function sendToAPI($url, $request = 'GET', $xml = array())
{
    if ($request != "GET") {
        if (substr_count($url, '?') > 0) {
            $url = str_replace('?', '.' . FORMAT . '?', $url);
        } else {
            $url .= '.' . FORMAT;
        }
    } else {
        if (substr_count($url, '?') > 0) {
            $url = str_replace('?', '.xml?', $url);
        } else {
            $url .= '.xml';
        }
    }
    //Problem here: DELETE doesn't seem to be working now.
    //arrayToXML is making the opening xml tag if nothing else, so the isempty seems to fail
    if (!empty($xml)) {
        $xml = arrayToXML($xml);
    } else {
        $xml = false;
    }
    //Not sure about this isEmpty is it even necessary?
    if (isEmpty($xml)) {
        $xml = false;
    }
    $ch = new miniCURL();
    $data = $ch->send($url, $request, $xml);
    return $ch->loadString($data);
}