This repository has been archived by the owner on Sep 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
alfa.sms.class.php
100 lines (82 loc) · 1.91 KB
/
alfa.sms.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/*************************************************************
* Alfasms API 4.0 for way2sms *
* Author : Alfred francis *
* Email : alfredputhurh@gmail.com *
* API homepage : www.alfredfrancis.in/alfasms-api *
* Feel free to edit,share and publish *
*************************************************************/
include_once "alfa.curl.class.php";
class AlfaSMS
{
var $username;
var $password;
var $number;
var $msg;
var $curl;
var $login;
var $post_data;
var $content;
var $url;
var $ref;
public function __construct()
{
$this->loginok=false;
$this->curl=new AlfacURL();
}
public function login($username,$password)
{
$post_data = "username=".$username."&password=".$password;
$url = "http://site1.way2sms.com/Login1.action";
$ref="http://site1.way2sms.com/content/index.html";
$content=($this->curl->post($url,$post_data,$ref));
if(stristr($content,"Invalid Mobile No"))
{
$this->login=false;
return false;
}
else
{
$this->login=true;
return true;
}
}
public function send($number,$msg)
{
if($this->login)
{
$msg=urlencode($msg);
$post_data ="action=sa65sdf656fdfd&HiddenAction=instantsms&catnamedis=Birthday&login=&pass=&MobNo=".trim($number)."&textArea=".$msg;
$url = "http://site1.way2sms.com/quicksms.action";
$ref="http://site1.way2sms.com/jsp/InstantSMS.jsp";
$content=($this->curl->post($url,$post_data,$ref));
if(stristr($content,"successfully"))
{
return true;
}
else
{
return false;
}
}
else
{
echo "<h2>Please login first before sending SMS</h2>";
}
}
public function logout()
{
$post_data ="1=1";
$url = "http://site1.way2sms.com/jsp/logout.jsp";
$content=($this->curl->post($url,$post_data));
if(stristr($content,"successfully"))
{
return true;
}
else
{
return false;
}
}
}
?>