Hi
I am trying to execute http web page through access 2010 form without opening web page... say its a text message to parents when paying fee .. so there is no need to open web page... i will do it through command button
I am trying to execute http web page through access 2010 form without opening web page
What exactly does 'execute web page' mean? It's not an EXE file.
If you just want to read part or all the web page without opening it, you can adapt the code in this example app checker/4594398125"]Web Version Checker[/URL]
Sorry. Still not clear.
Are you saying you want to include the web page address in your SMS? Or copy the entire web page in your SMS (surely not!)
Application.FollowHyperlink will always open the web page
I think you should ask your API provider for additional info on this.
My approach to sending SMS from Access is very different - see Twilio link given in previous thread. Was that useful to you?
Not sure why you've started another thread which continues on from this. Shall I merge them for you?
You still haven't explained what 'execute a web page' means
Dim [COLOR=#000000]message [/COLOR]As String
Dim [COLOR=#000000]result [/COLOR]As String
Dim [COLOR=#000000]myURL [/COLOR]As String, [COLOR=#000000]postData [/COLOR]As String
Dim [COLOR=#000000]winHttpReq As [/COLOR]Object
[COLOR=#000000]message [/COLOR]= [COLOR=#808080]"Hello this is a test message."
[/COLOR]Set [COLOR=#000000]winHttpReq [/COLOR]= [COLOR=#000000]CreateObject[/COLOR]([COLOR=#808080]"WinHttp.WinHttpRequest.5.1"[/COLOR])
[COLOR=#000000]myURL [/COLOR]= [COLOR=#808080]"http://sendpk.com/api/sms.php"
[/COLOR][COLOR=#000000]postData [/COLOR]= [COLOR=#808080]"username=923xxx&password=xxx&messsge=" [/COLOR]+ [COLOR=#000000]message [/COLOR]+
[COLOR=#808080]"&mobile=92300xxxxxxx&mask=BrandName&format=xml"
[/COLOR][COLOR=#000000]winHttpReq.Open [/COLOR][COLOR=#808080]"POST"[/COLOR], [COLOR=#000000]myURL[/COLOR], False
[COLOR=#000000]winHttpReq.SetRequestHeader "Content-Type"[/COLOR], [COLOR=#000000]"application/x-www-form-urlencoded"
winHttpReq.Send [/COLOR]([COLOR=#000000]postData[/COLOR])
[COLOR=#000000]SendSMS_Text [/COLOR]= [COLOR=#000000]winHttpReq.responseText[/COLOR]
Here is VB6 code from the manual?
Perhaps you can adapt that.?
Code:Dim [COLOR=#000000]message [/COLOR]As String Dim [COLOR=#000000]result [/COLOR]As String Dim [COLOR=#000000]myURL [/COLOR]As String, [COLOR=#000000]postData [/COLOR]As String Dim [COLOR=#000000]winHttpReq As [/COLOR]Object [COLOR=#000000]message [/COLOR]= [COLOR=#808080]"Hello this is a test message." [/COLOR]Set [COLOR=#000000]winHttpReq [/COLOR]= [COLOR=#000000]CreateObject[/COLOR]([COLOR=#808080]"WinHttp.WinHttpRequest.5.1"[/COLOR]) [COLOR=#000000]myURL [/COLOR]= [COLOR=#808080]"http://sendpk.com/api/sms.php" [/COLOR][COLOR=#000000]postData [/COLOR]= [COLOR=#808080]"username=923xxx&password=xxx&messsge=" [/COLOR]+ [COLOR=#000000]message [/COLOR]+ [COLOR=#808080]"&mobile=92300xxxxxxx&mask=BrandName&format=xml" [/COLOR][COLOR=#000000]winHttpReq.Open [/COLOR][COLOR=#808080]"POST"[/COLOR], [COLOR=#000000]myURL[/COLOR], False [COLOR=#000000]winHttpReq.SetRequestHeader "Content-Type"[/COLOR], [COLOR=#000000]"application/x-www-form-urlencoded" winHttpReq.Send [/COLOR]([COLOR=#000000]postData[/COLOR]) [COLOR=#000000]SendSMS_Text [/COLOR]= [COLOR=#000000]winHttpReq.responseText[/COLOR]
Public Function SendSMS_Text(message As String, number As String)
Dim message As String
Dim result As String
Dim myURL As String, postData As String
Dim winHttpReq As Object
message = "Hello this is a test message."
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
myURL = "http://sendpk.com/api/sms.php"
postData = "username=923xxx&password=xxx&messsge=" & message & _
"&mobile=" & number & "&mask=BrandName&format=xml"
winHttpReq.Open "POST", myURL, False
winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
winHttpReq.Send (postData)
SendSMS_Text = winHttpReq.responseText
Set WinHttpReq = Nothing
End Function
SjCc
I have looked back through this thread and others related to sending SMS from Access. Throughout you have been asked a lot of questions, many of which have not been answered or only partly answered
Firstly, in this thread https://www.access-programmers.co.uk/forums/showthread.php?t=301859 you talked about sending the SMS through a mobile phone connected using Bluetooth. Even if you have got that working, I would urge you to abandon that approach. Dropped connections will occur and you can almost guarantee corruption will follow.
In that same thread I recommended you read this article https://www.access-programmers.co.uk/forums/showthread.php?t=291805&highlight=Twilio. Did you do so? Although some of that was specific to using a specific provider, most of the code was generic and easily adapted for general use.
That was my starting point. I have sent batches of up to 1500 messages at a time using similar code. It works and is very fast. Also used for sending voice messages and for logging received SMS/voice messages.
In this thread, you have been advised by both Gasman and myself to ask your API provider for additional info. They know their system. Why are you reluctant to do so?
Finally you started yet another separate thread here https://www.access-programmers.co.uk/forums/showthread.php?t=301871. I offered to merge it but you ignored that suggestion and have had answers there since.
In summary you've had a lot of support from several people but you aren't making it easy to help you. Please respond to all questions you have been asked ...and contact your API provider.
SjCc
I have looked back through this thread and others related to sending SMS from Access. Throughout you have been asked a lot of questions, many of which have not been answered or only partly answered
Firstly, in this thread https://www.access-programmers.co.uk/forums/showthread.php?t=301859 you talked about sending the SMS through a mobile phone connected using Bluetooth. Even if you have got that working, I would urge you to abandon that approach. Dropped connections will occur and you can almost guarantee corruption will follow.
In that same thread I recommended you read this article https://www.access-programmers.co.uk/forums/showthread.php?t=291805&highlight=Twilio. Did you do so? Although some of that was specific to using a specific provider, most of the code was generic and easily adapted for general use.
That was my starting point. I have sent batches of up to 1500 messages at a time using similar code. It works and is very fast. Also used for sending voice messages and for logging received SMS/voice messages.
In this thread, you have been advised by both Gasman and myself to ask your API provider for additional info. They know their system. Why are you reluctant to do so?
Finally you started yet another separate thread here https://www.access-programmers.co.uk/forums/showthread.php?t=301871. I offered to merge it but you ignored that suggestion and have had answers there since.
In summary you've had a lot of support from several people but you aren't making it easy to help you. Please respond to all questions you have been asked ...and contact your API provider.
As June7 has mentioned in the other post, concatenate your varaiables with the string required,
In the example one would be message which is already being concatenated. I would be using & though.
Something along the lines of
then in your formCode:Public Function SendSMS_Text(message As String, number As String) Dim message As String Dim result As String Dim myURL As String, postData As String Dim winHttpReq As Object message = "Hello this is a test message." Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1") myURL = "http://sendpk.com/api/sms.php" postData = "username=923xxx&password=xxx&messsge=" & message & _ "&mobile=" & number & "&mask=BrandName&format=xml" winHttpReq.Open "POST", myURL, False winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" winHttpReq.Send (postData) SendSMS_Text = winHttpReq.responseText Set WinHttpReq = Nothing End Function
Result = SendSMS_Text(Me.Message,Me.Number)
As for speed, I'd try changing the code so that you send all the message in one creation of the WinHttpReq object, rather than creating/releasing each time, but as we do not know how your system is structured, it is hard to say.
This is all code I have not used before, so no knowledge. I would be in 'try and see' mode