Use this SMS gateway API to send SMS with PHP from your computer. This PHP SMS API is simple but powerful integration, enabling the capabilities to receive and send SMS with PHP from your existing messaging infrastructure. You’ll begin with the Core API. If you find you’d enjoy additional features – like bulk SMS distributions or scheduled message deliveries, for instance – simply use the Extended API. Click here for more technical details. Create your free 15-day, no-obligation trial account.
 

Features

  • Simple HTTP request
  • Communications secured with SSL encryption
  • Delivery status of message via function return code
  • Replies to your outbound SMS arrive back as emails

 

Example Source Code

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://sms1.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);
}