-
Notifications
You must be signed in to change notification settings - Fork 9
/
smsticketing.php
122 lines (109 loc) · 2.83 KB
/
smsticketing.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
include ('lib/nusoap.php');
$sender = $_GET['sender'] ;
$msg = $_GET['message'] ;
if(empty($msg))
{
$response="You have not entered any text";
print_r ($response);
}
if($msg=="info")
{
$response = "To view bus schedule sms the word 'view'.\n To Book a trip sms the word 'book' followed by your name, ID number and route separated by commas.\nTo change destination, sms the word 'change' followed by your ID number and new route.";
echo nl2br($response);
}
/*
if($msg=="register")
{
$client=new nusoap_client('http://127.0.0.1/bus/serverside.php');
$response=$client->call('registerCustomer');
print_r ($response);
}
*/
if($msg=="view")
{
$client=new nusoap_client('http://127.0.0.1/bus/serverside.php');
$response=$client->call('viewtrips');
print_r ($response);
}
/*
if($msg=="book")
{
$client=new nusoap_client('http://127.0.0.1/bus/serverside.php');
$response=$client->call('booktrip');
print_r ($response);
}
if($msg=="change")
{
$client=new nusoap_client('http://127.0.0.1/bus/serverside.php');
$response=$client->call('changedestination');
print_r ($response);
}
*/
echo getResponse($msg,$sender);
function getResponse($msg,$sender)
{
$smsresults=explode("#",$msg);
if ($smsresults [0]=="register")
{
$param=array('ID'=>$smsresults [1],'Name' =>$smsresults [2],'Phone_Number' =>$sender);
$client=new nusoap_client('http://127.0.0.1/bus/serverside.php');
$response=$client->call('registerCustomer',$param);
$error=$client->getError();
if($error)
{
echo "error".$error;
print_r($client->response());
print_r($client->getDebug());
die();
}
print_r($response);
}
/*
else if ($smsresults [0]=="view")
{
$param=array('trip_Id'=>$smsresults[1],'route'=>$smsresults[2],'departure_time'=>$smsresults[3],'arrival_time'=>$smsresults[4],'cost'=>$smsresults[3]);
$client=new nusoap_client('http://127.0.0.1/bus/serveside.php');
$response=$client->call('viewtrips',$param);
$error=$client->getError();
if($error)
{
echo "error".$error;
print_r($client->response());
print_r($client->getDebug());
die();
}
print_r($response);
}*/
else if ($smsresults [0]=="book")
{
$param=array('cust_Id' =>$smsresults[1],'trip_Id' =>$smsresults[2]);
$client=new nusoap_client('http://127.0.0.1/bus/serverside.php');
$response=$client->call('booktrip',$param);
$error=$client->getError();
if($error)
{
echo "error".$error;
print_r($client->response());
print_r($client->getDebug());
die();
}
print_r($response);
}
else if($smsresults[0]=="change")
{
$param=array('customer_id'=>$smsresults[1],'route'=>$smsresults[2]);
$client=new nusoap_client('http://127.0.0.1/bus/serverside.php');
$response=$client->call('changedestination',$param);
$error=$client->getError();
if($error)
{
echo "error".$error;
print_r($client->response());
print_r($client->getDebug());
die();
}
print_r($response);
}
}
?>