Guest
2007-05-14T10:04:30Z
I was considering purchasing IntelliSMS but was wondering about the functionality with my PHP form handler. The clients mobile number is a required form field and as the PHP form is passed across my server after submit I want a text to the clients email immediately i.e. "we have received your application, blah,blah" does IntelliSMS offer this facility and if so what should I be buying as I note there's about 4 opptions on the home page.
Regards
Martyn
Support
2007-05-14T10:29:37Z
Here is a PHP script for sending SMS messages form a web form. This script submits SMS messages to the IntelliSoftware SMS Gateway using the HTTP Protocol. This script was kindly provided to IntelliSoftware by Torstein Sorlid.

<?php
############################################################
# Code snippet by Torstein Sorlid, info@digitalfibre.co.uk #
############################################################

////////////////////////////////////////////////////////////
// Note that 'allow_url_fopen' must be enabled in php.ini //
////////////////////////////////////////////////////////////

//////////////////////////////////
// Replace this with your details:
$myUsername='username';
$myPassword='password';
//////////////////////////////////

// I recommend validating the POST values!
if($_POST['recipients'] && $_POST['message'])echo sendSMS($myUsername, $myPassword, $_POST['recipients'], $_POST['message'])."<br>";

function sendSMS($username, $password, $recipients, $message) // Multiple recipients must be comma-separated
{
	// URL encode message to allow for linebreaks, convert CRLF to simple linebreak
	$message=str_replace("%0D%0A", "%0A", urlencode($message));

	// Create URL
	$url="http://www.intellisoftware.co.uk/smsgateway/sendmsg.aspx?username=$username&password=$password&to=$recipients&text=$message";
	
	// Fake the browser type (for HTTP/1.0 compatibility - thanks to Jem Tallon at php.net)
	ini_set('user_agent','MSIE 4\.0b2;'); 

	// Process message, return result
	$dh=fopen("$url",'r'); 
	$result=fread($dh,8192);                                                                                                                            
	return $result; 
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SMS Test</title>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="5">
<form action="example.php" method="post">
  <tr>
    <td>Recipient(s):</td>
    <td><input name="recipients" type="text" value="i.e. 447710123456,447710654321" size="30" onFocus="if(this.value=='i.e. 447710123456,447710654321')this.value='';" onBlur="if(this.value=='')this.value='i.e. 447710123456,447710654321';"></td>
  </tr>
  <tr>
    <td valign="top">Message:</td>
    <td><textarea name="message" cols="25" rows="5" onFocus="if(this.value=='Up to 160 chars.')this.value='';" onBlur="if(this.value=='')this.value='Up to 160 chars.';">Up to 160 chars.</textarea></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><input type="submit" value="Send message"></td>
  </tr>
</form>
</table>
</body>
</html>
Guest
2007-05-15T21:54:37Z
Thanks very much for this, appreciated
Regards
Martyn
Guest
2007-05-23T14:27:58Z
This a great code, I use it but I want to know how can I add a signatue to all the SMS.
Regards.
Support
2007-05-23T15:10:17Z
Try inserting the line below:

function sendSMS($username, $password, $recipients, $message) // Multiple recipients must be comma-separated
{
    $message="$message%0D%0AMy Signature";   //Add Signature

    // URL encode message to allow for linebreaks, convert CRLF to simple linebreak
    $message=str_replace("%0D%0A", "%0A", urlencode($message));

   .............
Guest
2007-05-24T10:11:52Z
Thanks, would like to know If I want to add "from=Internet" how can I do it in the code?
and also upon receiving the messsage status that say ID1000001, can it say message sent?or can can it open a new page that say message sent?
Support
2007-05-24T10:35:22Z
To add a Sender's ID of 'Internet' simply edit the following line:

    // Create URL
    $url="http://www.intellisoftware.co.uk/smsgateway/sendmsg.aspx?username=$username&password=$password&to=$recipients&text=$message&from=Internet";
Support
2007-05-24T10:41:44Z
By recieving the ID you can assume the message as being sent.
Guest
2007-05-25T13:54:18Z
I know but the ID it not useful, I need something to not display the ID, only a simple text "Message Sent".How can I not receive the resposne and put that simple text?
Support
2007-05-25T15:49:37Z
A simply if statement and a string compare should do the trick. You should be able to find suitable resources on the internet to help you with PHP programming.
Guest
2007-05-25T16:01:45Z
I think I got it here is the code, can you try it for me:
Put it after
$result=fread($dh,8192);
return print $notification= "Message Sent ID";
Guest
2007-05-25T17:22:03Z
Support wrote:

To add a Sender's ID of 'Internet' simply edit the following line:

    // Create URL
    $url="http://www.intellisoftware.co.uk/smsgateway/sendmsg.aspx?username=$username&password=$password&to=$recipients&text=$message&from=Internet";



the &from=Internet at the end does work, can you find out how It can be donef?