I copied the link to the browser, changing to the desired login and password, etc., and the link works, sms comes to the phone.
Maksym Mudrakov:
I copied the link to the browser, changing to the desired login and password, etc., and the link works, sms comes to the phone.
I copied the link to the browser, changing to the desired login and password, etc., and the link works, sms comes to the phone.
You have to send the "str" in the link.
void SMSapi(string userID,string password,string senderID,string phone,string text) { int res; char data[]; string str="user="+userID+ "&pass="+password+ "&sender="+senderID+ "&phone="+phone+ "&text="+text+ "&priority=ndnd&stype=normal"; ArrayResize(data,StringToCharArray(str,data,0,WHOLE_ARRAY,CP_UTF8)-1); res=WebRequest("GET","http://bhashsms.com/api/sendmsg.php?"+str,NULL,0,data,data,str); Print(res); }
Laszlo Tormasi:
You have to send the "str" in the link.
I try this function, but result = -1 (don't work)
void SMSapi_2(string userID,string password,string senderID,string phone,string text){ string cookie=NULL, headers; char post[],result[]; int res; int timeout=5000; char data[]; string str="user="+userID+ "&pass="+password+ "&sender="+senderID+ "&phone="+phone+ "&text="+text+ "&priority=ndnd&stype=normal"; string url="http://bhashsms.com/api/sendmsg.php?"+str; res=WebRequest("GET",url,cookie,NULL,timeout,post,0,result,headers); Print(res); }
Have you added the link to the allowed URLs list?
Laszlo Tormasi:
Have you added the link to the allowed URLs list?
I added: "http://bhashsms.com/api/sendmsg.php"
and try to add: "http://bhashsms.com/api"
but it didn't help me.
Try this: http://bhashsms.com
DonFx:
Don't work.
Try this: http://bhashsms.com
Maksym Mudrakov:
Don't work.
Don't work.
You are doing something wrong.
I got the result with dummy login details: http://prntscr.com/fqxvpo
In some cases the 5 seconds timeout is not enough. You should increase that.
int OnStart() { string cookie=NULL, headers; char post[],result[]; int res; int timeout=5000; char data[]; string str="user=userID&pass=password&sender=senderID&phone=phone&text=text&priority=ndnd&stype=normal"; string url="http://bhashsms.com/api/sendmsg.php?"+str; res=WebRequest("GET",url,cookie,NULL,timeout,post,0,result,headers); Print(res," ",CharArrayToString(result)); return 0; }
Thank you very much!!!
I called WebRequest() from Indicator, that is why my attempts was wrong.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I have such LINK: http://bhashsms.com/api/sendmsg.php?user=userid&pass=userpass&sender=senderid&phone=mobile&text=alertmessage&priority=ndnd&stype=normal
I wrote code:
But this code don't work. I try "GET" and "POST" requests, but nothing. I read, that if in link "...sendmsg.php?.." there is "?" then it must be "GET" request.
Please, help me create correct request.
Thanks.