Free SMS sender for YOUR site, easy php setup!

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

#free-sms-script-wap

2 replies · 5,526 views · started 16 years ago · 2 min read

2 participants
jmprince80 Junior · 20 posts #1

Working on this now, you need a php server with file_get_contents() from URL available for it to work due to the auth process, you also need to have a site which has a user authentication method (ie login and password) you can modify the code posted here for your own purposes 🙂 If you want an account set up for your site and any help on how to get it working, please PM me and I will set you up an account. I will need only your server's IP address, and your site's name. (to associate site ID with server IP) First bit of code is the authenticator (its kinda like a 2-way handshake thing 🙂 ) sms is unlimited and should send to any country 🙂

so you can see that sms works, sign up at http://dl.cq.hk then pm me if you want sms for your site! Coming soon is a sitebuilder with WML XHTML and full web PHPBB style forum with integrated SMS function 😀

WML support will be added tomorrow during the day. If anyone would like an account so they can set their site up,

please pm me with the following details: your server's IP address (the address that PHP will nake the file_get_contents() call from) your name your site's name your email address... any other info you think might help.

If you are unable to modify your own site to include my code that was posted, I will alter your sites code to work with it for $20, or i will help people to do it themselves by replying to posts in this topic!

You can get started by sending me a PM with your servers IP address, URL, site name and your email address.

I will then reply with a value for $sms_siteid (kinda like a password) which you must enter into the code below.

<?php

$access=true;

/** Insert here your site's authentication checks to make sure the user is logged in before allowing
*** him or her to continue using the remainder of this script. Site owners found not to be complying
*** with this will have their access to the sms service removed!
***
*** e.g:
***
***  if(user_authorized($sessionid)){ $access = true; } else {$access = false;}
**/

$sms_siteid='';        

/// NOTE Set this to your SITEID, which you will have recieved when you registered your site for
/// NOTE the SMS Sender! Your SITEID is associated with your server's IP address, so this must be
/// NOTE correct otherwise the sms sender will give an access denied message.

$sms_user=$login;

/// NOTE This is the user's login name on your site, you will need to add code to get this from your
/// NOTE site's database.

$sms_sitename="yoursitename.com";    

/// NOTE Change this to your site's name as you'd like it to appear on the SMS sending page.

$sms_sitetext="Welcome to yoursitename sms!";

/// NOTE This text is displayed on the sms sender page, you could put instructions etc here..

$sms_returnurl="http://yoursitename.com/";

/// NOTE This should link back to your site so that the user can return to your site when they have
/// NOTE finished sending texts. You could insert a complete link with sessionid so that the user
/// NOTE doesnt have to re-login to your site. These details will NEVER be stored or abused by us, and if
/// NOTE your sessions are locked to the IP used to create the session, this will never be a security issue
/// NOTE anyway.

$sms_logo="http://yoursitename.com/images/logo.jpg";

/// NOTE This is an optional logo displayed above the main part of the sms page to personalize the look
/// NOTE of the sender for your own needs...

$sms_ad=" via yoursite.com";

/// NOTE This is an optional (up to 20 chars long) advert which can be appended to the end of the SMS
/// NOTE that are sent from your site.

if($access){
  $url=setAuth($sms_user,$sms_siteid,$sms_sitetext,$sms_logo,$sms_returnurl,$sms_ad);
  rhead($sitename.' SMS',0,0,false,'993333');
  echo('<p align="center">');
  echo("Welcome to SMS at $sms_sitename, $sms_user<br/><br/>");
  echo("Please click the link below to enter SMS page:<br/><a href=\"$url\">> Go to SMS Page <</a><br/>");
  echo('</p>');
  rfoot();
} else {
  rhead('Authentication Problem',0 ,0,false,'993333');
  echo('<p align="center">');
  echo("Please go back to <a href=\"$sms_returnurl\">$sms_sitename</a> and re-visit the link to SMS to try again.");
  echo('</p>');
  rfoot();
}
die();

function setAuth($sms_user,$sms_siteid,$sms_sitetext,$sms_logo,$sms_returnurl,$sms_ad){
  $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  $sms_at='';
  for($i=0;$i<16;$i++){
    $c=substr($chars,rand(0,(strlen($chars)-1)),1);
    $sms_at.=$c;
  }
  $url="http://dl.cq.hk/sms_authchk.php?u=$sms_user&s=$sms_siteid&sa=".urlencode($sms_ad)."&a=$sms_at&r=".urlencode($sms_returnurl)."&n=".urlencode($sms_sitetext)."&l=".urlencode($sms_logo);

$output=file_get_contents($url);
//echo($output);
$goto=explode(']]]]]',$output);
$goto=$goto[1];
return($goto);
}

function rhead($title, $timer, $dest, $allowcache, $bgcol){
$id='x';

if(!stristr($_SERVER['HTTP_ACCEPT'],'text/html')){
  header('Content-Type: text/vnd.wap.wml; charset=utf-8');
  if(!($allowcache)){
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");                
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");    
    header("Cache-Control: no-cache, must-revalidate, private");            
    header("Pragma: no-cache");
  }
  echo('<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">');
  echo('<wml>');
  echo('<card id="'.$id.'" title="'.$title.'">');
} else {
  header('Content-Type: text/html');
  if(!($allowcache)){
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");                
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");    
    header("Cache-Control: no-cache, must-revalidate, private");            
    header("Pragma: no-cache");
  }
  echo('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
  echo('<html>');
  echo('<head><title>'.$title.'</title>');
  if($timer){
    echo('<meta http-equiv="refresh" content="'.$timer.';url='.$dest.'" />');
  }
  echo('</head><body bgcolor="#'.$bgcol.'">');
}

} 

function rfoot(){
  if(!stristr($_SERVER['HTTP_ACCEPT'],'text/html')){
    echo('</card></wml>');
  }else{
    echo('</body></html>');
  }
}

?>

This should work for WAP and XHTML capable phones. It will default to WML if the users phone is not able to support XHTML.

jmprince80 Junior · 20 posts #3

I'm using my own custom network of SMS servers spread over several countries linked with VPN connections.

SMS is unlimited, because......

I'm not having to pay for the SMS myself due to the ways in which they are sent 🙂

There is no guarantee that SMS will be sent, but if you look, you will see that the chances are pretty good 😀

Can send ringtones, WAP Push, MMS Push, VCards, and other 8-bit message formats 🙂

Great for advertising sites via SMS etc but I just want people to save money and find my sites and those of anyone who would like to use our sms service!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close