8
8
URL = 'http://site1.way2sms.com'
9
9
username = '' ## way2sms login
10
10
password = '' ## way2sms password
11
- message = "Hello I'm Cheating Way2SMS :)" ## Message to be Sent
11
+ message = "Hello World :)" ## Message to be Sent
12
12
number = '' # Receiver mobile number
13
13
14
14
## With the above change you need to provide your Action on line number
17
17
18
18
def set_header ( cookie = nil , referer = nil )
19
19
{ "Cookie" => cookie , "Referer" => referer , "Content-Type" => "application/x-www-form-urlencoded" , "User-Agent" => "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20091020 Ubuntu/9.10 (karmic) Firefox/3.5.3 GTB7.0" }
20
- end
20
+ end
21
21
22
22
http = Net ::HTTP . new ( uri . host , uri . port )
23
-
23
+
24
24
if uri . scheme == "https"
25
25
http . use_ssl = true
26
26
http . ca_path = "/etc/ssl/certs"
27
27
http . verify_mode = OpenSSL ::SSL ::VERIFY_PEER
28
- end
28
+ end
29
29
30
30
31
31
32
32
33
- def fetch ( http , path , header , data = nil , method = :get , limit = 10 )
33
+ def fetch ( http , path , header , data = nil , method = :get , limit = 10 )
34
34
raise ArgumentError , 'HTTP redirect too deep' if limit == 0
35
35
cookie ||= header [ 'Cookie' ]
36
36
referer ||= header [ 'Referer' ]
37
37
if method == :get
38
38
response = http . get ( path , header . delete_if { |i , j | j . nil? } )
39
- else
39
+ else
40
40
response = http . post ( path , data , header . delete_if { |i , j | j . nil? } )
41
41
cookie ||= response [ 'set-cookie' ]
42
- end
43
-
44
- case response . code
42
+ end
43
+
44
+ case response . code
45
45
when /2\d {2}/
46
- return [ cookie , referer , response , http ]
46
+ return [ cookie , referer , response , http ]
47
47
when /3\d {2}/
48
48
cookie , referer , response , http = fetch ( http , ( "/" +response [ 'location' ] . match ( URL_REGEX ) [ 1 ] ) , set_header ( cookie , ( URL +path ) ) , limit -1 )
49
49
return [ cookie , referer , response , http ]
50
50
else
51
51
return "HTTP Error"
52
- end
52
+ end
53
53
end
54
54
55
55
@@ -65,9 +65,9 @@ def fetch(http,path,header,data=nil,method=:get,limit=10)
65
65
66
66
message = CGI . escape ( message )
67
67
68
- ## The Action obtained from the way2sms on page after successful login the form of the quick message submission by inespecting it using firebuglite
69
- ## Action need to be replace with yours --------
70
- # |
68
+ ## The Action obtained from the way2sms on page after successful login the form of the quick message submission by inespecting it using firebuglite
69
+ ## Action need to be replace with yours --------
70
+ # |
71
71
sms_data = 'HiddenAction=instantsms&Action=hgfgh5656fgd&MobNo=' +number +'&textArea=' +message
72
72
73
73
cookie , referer , response , http = fetch ( http , '/quicksms.action' , set_header ( cookie , referer ) , sms_data , :post )
0 commit comments