PHP API

white

The best way to use the Red Oxygen API from PHP is to use the HTTP interface.

Example

function SendMessage($AccountID, $Email, $Password, $Recipient, $Message)
{
	$Parameters['AccountID'] = $AccountID;
	$Parameters['Email'] = $Email;
	$Parameters['Password'] = $Password;
	$Parameters['Recipient'] = $Recipient;
	$Parameters['Message'] = $Message;
 
	Request($Parameters, 'http://www.redoxygen.net/sms.dll?Action=SendSMS');
}
 
function Request($Parameters, $URL)
{
	$URL = preg_replace('@^http://@i', '', $URL);
	$Host = substr($URL, 0, strpos($URL, '/'));
	$URI = strstr($URL, '/');
	$Body = '';
 
	foreach($Parameters as $Key => $Value)
	{
		if (!empty($Body))
		{
			$Body .= '&';
		}
 
		$Body .= $Key . '=' . urlencode($Value);
	}
 
	$ContentLength = strlen($Body);
 
	$Header = "POST $URI HTTP/1.1\n";
	$Header .= "Host: $Host\n";
	$Header .= "Content-Type: application/x-www-form-urlencoded\n";
	$Header .= "Content-Length: $ContentLength\n\n";
	$Header .= "$Body\n";
 
	$Socket = fsockopen($Host, 80, $ErrorNumber, $ErrorMessage);
	fputs($Socket, $Header);
 
	while (!feof($Socket))
	{
		$Result[] = fgets($Socket, 4096);
	}
 
	fclose($Socket);
}

Properties

Name Description Example
AccountID This is your Red Oxygen Account ID, which uniquely identifies your account. CI00000001
Email This is the email address of your Red Oxygen user account. It is also the address that will receive replies to the sent SMS. username@company.com
Password This is the password of your Red Oxygen user account. secret
Recipient The destination mobile numbers. Multiple recipients can be specified comma separated. 61409000000,61419718927,61419718972
Message A single SMS has a maximum length of 160 characters. If the message is greater than 160 characters then multiple SMS will be sent as a concatenated SMS which will result in an additional charge for the additional messages. The maximum length of a message is 765 characters. If you exceed this limit only the first 765 characters of your message will be sent. Server 23 is offline.

For more details see the Red Oxygen API HTTP User Guide.

Want us to set it up for you?

Get in touch with our team and we will get back to you as soon as possible!

    white