示例#1
0
define("SENDEGA_DEVMODE", true);
// If you are using "mock messages"
require realpath(__DIR__ . "/../src/Sendega.php");
if (!Sendega::CheckWhitelist($_SERVER['REMOTE_ADDR'])) {
    header("HTTP/1.1 401 Unauthorized");
    exit;
}
if ($data = Sendega::ParseMessage()) {
    // Store your message
    header("HTTP/1.1 200 OK");
    exit;
}
header("HTTP/1.1 400 Bad Request");
///////////////////////////////////////////////////////////////////////////////
// 2: Delivery Reports
///////////////////////////////////////////////////////////////////////////////
define("SENDEGA_DEVMODE", true);
// If you are using "mock messages"
define("SENDEGA_DLR", "http://myserver.com/sms_gateway");
// Set this in your send message script
require realpath(__DIR__ . "/../src/Sendega.php");
if (!Sendega::CheckWhitelist($_SERVER['REMOTE_ADDR'])) {
    header("HTTP/1.1 401 Unauthorized");
    exit;
}
if ($data = Sendega::ParseDeliveryReport()) {
    // Store your delivery report
    header("HTTP/1.1 200 OK");
    exit;
}
header("HTTP/1.1 400 Bad Request");
示例#2
0
<?php

/**
 * Sendega MMS/SSM Wrapper library -- Client Examples
 *
 * @author Anders Evenrud <*****@*****.**>
 */
define("SENDEGA_USERNAME", "your_username");
define("SENDEGA_PASSWORD", "your_password");
define("SENDEGA_SENDER", "your_number");
require realpath(__DIR__ . "/../src/Sendega.php");
$recipient = "0012345678";
// Country code + number
// Get recipient network information
var_dump(Sendega::SubscriberEnquiry($recipient));
// Get recipient location information
var_dump(Sendega::HomeLocationEnquiry($recipient));
// Send SMS
var_dump(Sendega::SendSMS($recipient, "This is an SMS message"));
// Send MMS (blob/string file attachments)
var_dump(Sendega::SendMMS($recipient, "MMS Message title", array("test.jpg" => file_get_contents("/tmp/test.jpg"))));
// Send MMS (file attachments)
var_dump(Sendega::SendMMS($recipient, "MMS Message title", array("/tmp/test.jpg")));