function pugpig_send_urban_airship_push($key, $secret, $num, $message, $content_available = false, $proxy_server = '', $proxy_port = '')
{
    if (empty($message) && !$content_available) {
        // note that we shouldn't get here as the client should
        // not attempt sending without a payload
        return "Did not send a Push as no message nor content specified.";
    }
    $contents = array();
    if (!empty($message)) {
        $contents['alert'] = $message;
    }
    if ($content_available) {
        $contents['badge'] = $num;
        $contents['content-available'] = 1;
    }
    $push = array("aps" => $contents);
    $json = json_encode($push);
    $response = pugpig_push_to_urban_airship_curl($key, $secret, $json, $proxy_server, $proxy_port);
    if ($response['http_code'] != 200) {
        $code = $response['http_code'];
        $content = $response['content'];
        return "Failed to send Newsstand push. Push to Urban Airship got negative response from server ({$code} - {$content}). Please confirm your settings.";
    }
    if ($content_available) {
        if (empty($message)) {
            return "Sent Newsstand Push with no Message";
        } else {
            return "Sent Newsstand Push with Message (" . $message . ")";
        }
    }
    return "Sent Message only (" . $message . ")";
}
function pugpig_push_to_urban_airship($key, $secret, $num, $message, $proxy_server = '', $proxy_port = '')
{
    $contents = array();
    $contents['badge'] = $num;
    $contents['content-available'] = 1;
    $push = array("aps" => $contents);
    $json = json_encode($push);
    $response = pugpig_push_to_urban_airship_curl($key, $secret, $json, $proxy_server, $proxy_port);
    if ($response['http_code'] != 200) {
        return "Failed to send Newsstand push. Push to Urban Airship got negative response from server. Please confirm your settings.";
    }
    // If we have a message, send that too
    if ($message != '') {
        $contents = array();
        $contents['alert'] = $message;
        $push = array("aps" => $contents);
        $json = json_encode($push);
        $response = pugpig_push_to_urban_airship_curl($key, $secret, $json, $proxy_server, $proxy_port);
        if ($response['http_code'] != 200) {
            return "Failed to send alert. Push to Urban Airship got negative response from server. Please confirm your settings (" . $response['http_code'] . ")";
        } else {
            return "Sent Newsstand Push and Alert (" . $message . ")";
        }
    } else {
        return "Sent Newsstand Push only";
    }
}