mIRC Home    About    Download    Register    News    Help

Print Thread
sms through sockets #67188 09/01/04 05:19 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
Hi!

How do I make a socket that can send an sms to an website wich will acctually send it.. The website doesn`t have a login page.. you send from the main paige..

Thanks! smile

Re: sms through sockets #67189 09/01/04 07:29 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Im not able to test this, as I dont know a person with this kind of phone, I just happened to remember they dont have a login either. This will (or atleast should) send a message to a person on the virgin network via sms. Hopefully it gives you enough info to if anything give you an idea how to go about doing so.

Code:
dialog sms {
  title "Virgin Mobile SMS"
  size -1 -1 75 109
  option dbu
  text "To (Customer Number):", 1, 0 0 75 8
  edit "", 10, 0 8 75 10
  text "From (You):", 2, 0 19 75 8
  edit "", 20, 0 27 75 10
  text "Message:", 3, 0 38 75 8
  edit "", 30, 0 46 75 50, multi autovs limit 125
  button "Send", 40, 40 98 35 10
  text "Chars: 0/125", 35, 0 99 40 8
}

alias sms { /dialog -md sms sms }

on *:DIALOG:sms:EDIT:30: {
  var %txt = $didtok($dname, 30, 0)
  var %len = $len(%txt)
  /did -ra $dname 35 Chars: %len $+ /125
}

on *:DIALOG:sms:SCLICK:40: {
  if (($did($dname, 10)) && ($did($dname, 20))) {
    if ($did($dname, 30)) {
      /sockopen sms www.virginmobileusa.com 80
      /sockmark sms sms
      /did -a $dname 30
    }
    else avr %a = $input(You have not specified a message to send, ow, Missing Field)
  }
  else var %a = $input(Missing to and/or from fields, ow, Missing Fields)
}

on *:SOCKOPEN:sms: {
  var %dname = $sock($sockname).mark
  if ($sockerr) .timer 1 1 var %a = $input(Could not send message to $did(%dname, 10), ow, Error)
  else {
    /sockwrite -n $sockname POST /xtras/messaging/processSMSMessage.do HTTP/1.0
    /sockwrite -n $sockname Host: www.virginmobileusa.com
    /sockwrite -n $sockname $crlf

    var %to = $(?,to=,$did(%dname, 10)), %from = $+(&,from=,$did(%dname, 20))
    var %message = $+(&,message=,$replace($didtok(%dname, 30, 32), $chr(32), +))

    /sockwrite -n $sockname $+(%to,%from,%message)
  }
}

on *:SOCKREAD:sms: {
  /sockread -f &data
  /bwrite data.txt - 1 -1 &data
}


And here is the form field I was after
Code:
          <form name="smsForm" method="post" action="/xtras/messaging/processSMSMessage.do">

          To: (mobile phone number)
          <input type="text" name="to" maxlength="14" size="13" value="" style="width: 240px">

          From: (you)
          <input type="text" name="from" maxlength="28" size="13" value="" style="width: 240px">

          Message:
          <textarea name="message" cols="25" rows="5" style="width: 240px"></textarea><!-- limit of 125 chars -->

          <input type="image" src="/images/common/btn_send.gif" width="40" height="15" alt="send" border="0">
          </form>


The site was www.virginmobileusa.com Since the form posts to /...blah... , the first / means "root" or "website base". If it says otherwise, you want it to reference off the current loction. i.e. if you were at:

www.virginmobileusa.com/sms/send.htm
and the form pointed to:
send.cgi

then you're actually looking for www.virginmobileusa.com/sms/send.cgi

Hope that gives you a better understanding. Anyways, again it hasn't been tested, and i didn't add anything to actually test the success of a send, because I don't know what is on the end result page.


-KingTomato
Re: sms through sockets #67190 09/01/04 09:27 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
i get this in the text file:

HTTP/1.1 405 Method not allowed
Server: Microsoft-IIS/5.0
Date: Fri, 09 Jan 2004 21:30:42 GMT
Allow: OPTIONS, TRACE, GET, HEAD, PUT, DELETE, POST
Content-Length: 3923
Content-Type: text/html

and alot of other things...
Whats wrong??