Hello,
I need to write a programm in C++ to send a sms from a PC to a mobile phone as a part in my project, so can you please help me?
Reegards,
Noora
contact a service provider, they'll have APIs for you (at a price).
contact a service provider, they'll have APIs for you (at a price).
Thank you, but the problem the service provider they offer applications, but I need a code to add it to my software. I am going to add this sms code to my main code, so do you have any suggestion?
> but the problem the service provider they offer applications,
Find out more about what they offer, read some documentation.
Maybe it's all done through a nice DLL you can just link to.
Or maybe it's a simple command line program where you can do "sendSms number message", which would be dead easy to use from your code.
http://clusty.com/search?query=web+sms+gateway&sourceid=Mozilla-search
If you talk to the consumer helpdesk or salesrep, they will indeed give you (or sell you) a ready made piece of software (which is what mom and pop want).
You'll need to dig deeper, or maybe go to a specialised company, to get an API.
Thanks Salem and jwenting, I will contact my service provider...
Also I am thinking to use visual because it is easier to send sms using a GSM modem and I will connect the C++ and visual codes together...
Thanks again...
please give me the suggestion and cheapest way(cost) for sending sms from computer (linux)to mobile for project? and also we need code for that urgently
I've used the old Ericsson mobiles to read contents of SIM cards and to send/read SMSs. The commands are sent to the mobile using your serial port at 9600,n,8,1 - you will need to convert the RS232 level (+/- 10 volts) to TTL level (0-5 volts) - can use MAX232 or some transistors & resistors - or you can use a ready made cable (don't know where you'd get it - maybe eBay).
Then send serial AT commands to the mobile, as detailed in:
http://www.usbdeveloper.com/GSMPage/gsmpage.htm
(there may be some Nokia commands here also?)
Old Nokia phones can be used in a similar manner. I assume a different command set is required. Check out www.siliconchip.com.au as they have some projects on using Nokia phones for sending/receiving SMSs.
Simple!
I've used the old Ericsson mobiles to read contents of SIM cards and to send/read SMSs. The commands are sent to the mobile using your serial port at 9600,n,8,1 - you will need to convert the RS232 level (+/- 10 volts) to TTL level (0-5 volts) - can use MAX232 or some transistors & resistors - or you can use a ready made cable (don't know where you'd get it - maybe eBay).
thanks
it works.i connected it.but while sending sms error cms330 occured.
actually it is sms centre unknown.how will we proceed furtherat ok at+cmgf=1 ok at+cmgw="+91347675898908" >msg ctrl+z cms error330
we are trying to send message from pc to mobile by using hyperterminal using AT commands.
we have encountered a problem
while typing reciever number
at+cmgs="xxxxxxxxxxx" we got +cms:304 error
but not always.sometimes it works and we can send msg .the mobile and pc used was same.
please help us to rectify that
tnx
I've never used the cmmf=1, I've only used the default (PDU: mode 0) and it works without any probs. This does require a little extra code, but it's quite simple (packing the 7-bit characters).
I don't know which AT command guide you are looking at, but mine has completely different parameters to all the AT commands that you're sending.
I've attached the code I used to send SMSs, it's in BASIC so you'll have to convert it to C++ or I'll get kicked off this site.
'Author: Doug
DECLARE SUB encode (s$)
DECLARE FUNCTION getstr$ (st$, num!)
DECLARE FUNCTION swap2$ (s$)
'sends SMS's to people
CLOSE
OPEN "com2:9600,n,8,1" FOR RANDOM AS #1
CLS
PRINT #1, "atz"
GOSUB dispinp
INPUT "Enter name: ", name$
PRINT #1, "at+cpbf=" + CHR$(34) + name$ + CHR$(34)
GOSUB dispinp
phonenum$ = MID$(in$, INSTR(in$, "," + CHR$(34)) + 2, INSTR(in$, CHR$(34) + ",") - INSTR(in$, "," + CHR$(34)) - 2)
phonenumlen = LEN(phonenum$)
IF (phonenumlen AND 1) THEN phonenum$ = phonenum$ + "f"
PRINT "Phonenum: "; phonenum$; ": len:"; phonenumlen
phonenum$ = swap2$(phonenum$)
PRINT "Message (2 lines): "
INPUT msg$
msglen = LEN(msg$)
b$ = ""
FOR i = 1 TO msglen STEP 8
a$ = getstr$(msg$, 8)
encode a$
b$ = b$ + a$
NEXT
msg$ = LEFT$(b$, INT(msglen * 7 / 8 + .9) * 2)
PRINT msg$
INPUT "Do you want to send it now? (y/n)", yn$
IF yn$ = "y" THEN
PRINT #1, "at+cmgf=0"
GOSUB dispinp
PRINT #1, "at+csms=0"
GOSUB dispinp
pnl$ = HEX$(phonenumlen)
IF LEN(pnl$) < 2 THEN pnl$ = "0" + pnl$
msglen$ = HEX$(msglen)
IF LEN(msglen$) < 2 THEN msglen$ = "0" + msglen$
cmd$ = "001100" + pnl$ + "91" + phonenum$ + "0000aa" + msglen$ + msg$ + CHR$(26)
PRINT "at+cmgs=" + LTRIM$(STR$((LEN(cmd$) - 1) / 2))
'GOSUB dispinp
PRINT cmd$
'GOSUB dispinp
IF in$ = "OK" THEN PRINT "Message sent!!"
END IF
CLOSE
END
dispinp:
LINE INPUT #1, in$:
PRINT in$
LINE INPUT #1, in$:
PRINT in$
LINE INPUT #1, in$:
PRINT in$
RETURN
SUB encode (s$)
DIM a(8), b(8)
FOR i = 1 TO 8
a(i) = ASC(getstr$(s$, 1))
NEXT
b(1) = a(1) + (a(2) AND 1) * 128
b(2) = a(2) \ 2 + (a(3) AND 3) * 64
b(3) = a(3) \ 4 + (a(4) AND 7) * 32
b(4) = a(4) \ 8 + (a(5) AND 15) * 16
b(5) = a(5) \ 16 + (a(6) AND 31) * 8
b(6) = a(6) \ 32 + (a(7) AND 63) * 4
b(7) = a(7) \ 64 + (a(8) AND 127) * 2
o$ = ""
FOR i = 1 TO 7
a$ = HEX$(b(i))
IF LEN(a$) < 2 THEN a$ = "0" + a$
o$ = o$ + a$
NEXT
s$ = o$
END SUB
FUNCTION getstr$ (st$, num)
IF LEN(st$) < num THEN st$ = st$ + STRING$(num - LEN(st$), 0)
getstr$ = LEFT$(st$, num)
st$ = RIGHT$(st$, LEN(st$) - num)
END FUNCTION
SUB sdecode (s$)
DIM a(8), b(8)
FOR i = 1 TO 7
a(i) = VAL("&h" + getstr$(s$, 2))
NEXT
b(1) = a(1) AND 127
b(2) = (a(2) AND 63) * 2 + a(1) \ 128
b(3) = (a(3) AND 31) * 4 + a(2) \ 64
b(4) = (a(4) AND 15) * 8 + a(3) \ 32
b(5) = (a(5) AND 7) * 16 + a(4) \ 16
b(6) = (a(6) AND 3) * 32 + a(5) \ 8
b(7) = (a(7) AND 1) * 64 + a(6) \ 4
b(8) = a(7) \ 2
o$ = ""
FOR i = 1 TO 8
o$ = o$ + CHR$(b(i))
NEXT
s$ = o$
END SUB
FUNCTION swap2$ (s$)
o$ = ""
FOR i = 1 TO LEN(s$) STEP 2
o$ = o$ + MID$(s$, i + 1, 1)
o$ = o$ + MID$(s$, i, 1)
NEXT
swap2$ = o$
END FUNCTION
hi;
i am already able to send sms by using hyper terminal. but now, i am going to add some code into to C++, so that the programe can send sms through hyper terminal. can anyone help me, pls. thanks
i need code for pc to mobile to send and recieve sms in c++
My work uses software like that can sent SMS from your computer. I think it is called Red Oxygen www.redoxygen.com but im not sure. I can send SMS from Outlook just like email. They also have an API code and it can be put into basically any program.
Hope this helps.
hy
im online on 10 pm
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.