Tuesday, August 28, 2012

send sms via way2sms using php

 Send SMS through way2sms   using php   


1.  download one rar file    -   click here to download

2.  extract the rar file

3. copy the below code and save sms.php

sms.php 

<HEAD>
 <TITLE>   </TITLE>
</HEAD>


<body bgcolor=#FFFFC0>
<form name="form1"  action="sms.php" method="post" >

<?php


$to=$_POST['to'];
$body=$_POST['body'];  
  
  
?>


<table>
            <tr><td><p>Phone number:</p></td><td><input name="to" id="No1" value="<?echo $to; ?>" size="53"   ></td></tr>
            <tr><td><p>Message:</p></td><td><textarea name="body" cols="40" rows="3"><?echo $body; ?></textarea></td></tr>
            <tr><td>&nbsp;</td><td><input type="submit" value="Send SMS" ></td></tr>
  </table>
<?  
  
    if($to!='' && $body!='') {  

include_once "../alfa/alfa.sms.class.php";
/*
If you get Fatal error: Call to undefined function curl_init() ,
Then you need to enable the curl extension in php.ini from your controlpanel.
If your server is not supporting cURL use my online version @ www.alfredfrancis.in/alfasms-api
*/
//initialising AlfaSMS API Class
$sms=new AlfaSMS();

echo " Logging in.. <br>";

//Replace useranme and password with your way2sms username and password
$result=$sms->login('9047956658','password');




    if($result)
    {
        echo "Sending SMS..<br> ";
       
        //It'll be my pleasure to receive a sms from you
        $result=$sms->send($to,$body);
       
            if($result)
            {
                echo " SMS send sucessfully !";
            }
            else
            {
                echo " Cant send SMS,Invalid content or Mobile number !<br>";
            }
    }
    else
    {
    echo " Wrong username or password!<br>";
    }
  
    echo " Logging out  ... <br>";
        $sms->logout();
  
    }
  


//Alfasms is loging out

?>
</form>
</BODY>

</HTML>


 *****************   important   remark    *************


Go to your php.ini file and remove the ; mark from the beginning of the following line:

;extension=php_curl.dll

16 comments:

  1. fed uppp with thiss...
    fatal error: Call to undefined function curl_init() in C:\wamp\www\shenvell\templatemo_329_blue_urban\alfa\alfa.curl.class.php on line 80
    Call Stack
    # Time Memory Function Location
    1 0.0006 253888 {main}( ) ..\sms.php:0
    2 0.0029 319840 AlfaSMS->login( ) ..\sms.php:29
    3 0.0029 320248 AlfacURL->post( ) ..\alfa.sms.class.php:38

    ReplyDelete
  2. Go to your php.ini file and remove the ; mark from the beginning of the following line:

    ;extension=php_curl.dll



    ReplyDelete
    Replies
    1. in php.ini file search the line

      ;extension=php_curl.dll

      remove ;

      extension=php_curl.dll

      save the file and restart apache or wamp server

      Delete
  3. i have figured out the problem with my wamp Tamil. and now my curl is enabled..
    got error in code saying..
    phoneno hai Logging in..
    Sending SMS..
    Cant send SMS,Invalid content or Mobile number !
    Logging out ...

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. where is php.ini file
    plz explain procedure in detail

    ReplyDelete
  6. I too am facing the same error...
    Logging in..
    Sending SMS..
    Cant send SMS,Invalid content or Mobile number !
    Logging out ...

    what is the solution to this

    ReplyDelete
    Replies
    1. https://github.com/kingster/Way2SMS-API

      use this api

      Delete
  7. Notice: Undefined offset: 0 i got this error repeatedly can anyone help to figure out this.

    ReplyDelete
  8. https://drive.google.com/file/d/0B9DBPH5xymtxN1MwN0d6NHNnaWs/view?usp=sharing

    WORKING CODE.. ANYONE CAN DOWNLOAD---- ENTER YOUR PHONE NUMBER AND PASSWORD..

    IT WORKS.... 100%..........

    ReplyDelete
    Replies
    1. hi pandian
      im trying on your code but still not working on my localhost

      Delete
  9. code works 100%, sms sending functionality is working perfectly. and only one thing you need to modify in index.html file replace hidden keyword with placeholder. heartfull thankful to Mr.pandian M sir.

    ReplyDelete
  10. Thanks for sharing. This code is not properly work. Use MsgClub Bulk sms api php and send number of sms.

    ReplyDelete

Labels

AJAX (1) Answers (1) Apache (1) Array (16) bug (1) C (1) C++ (1) Calendar (1) Class (1) Commands (1) Cookies (2) Database (2) Date (7) Days (1) explode (1) File Upload (1) FILES (1) firewall (1) fix (1) Functions (26) GET (1) GMT (1) JavaScript (2) localhost (1) Mail (1) Menu (1) MYSQL (13) PERL (1) PHP (36) php.ini (1) POST (1) preg_match (1) Questions (1) Script (1) SMS (2) Solution (1) String (1) Time (5) Time Zone (1) Vista (1) Wamp Server (1) windows 7 (2) XML (1)

Popular Posts

Popular Posts