Using URLConnection in PerformAction

Once a day I have to send a batch sms’s from a webApp.
I added a timer to the app so the process is independent of a session.
Al this works fine, but now I try to figure out how I can connect to the sms-provider. I assume I should use URLConnection in PerformAction of the ActionNotificationReceiver.
But I don’t know how to implement this. Is it possible? Is there an example I can check?

Thanks for an answer.

Hi Herman, has the SMS provider given you an API or any documentation on how they’d like you to send in your requests?

Hi William, I have documentation of the API, but this is not the problem. I just have to establish the connection.

Have you reviewed the Examples in: Examples - Communication - Internet - Web Services? (Xojo2023r1.1)

I did, adding URLConnection to a webpage is not a problem. Adding it to an ActionNotificationReceiver is another thing…

If you don’t need to handle any of the events of the URLConnection, it is pretty simple:

Var socket as New URLConnection 
socket.send("POST", theAPI_URL)

The socket will stay alive until it completes, even if it goes out of scope.

On the other hand, if you need to handle the events, you’ll probably need to use AddHandler or delegates

Thanks Jeremy.

I only have to handle a response code.

This works for me!

var socket as new URLConnection
var response as string = socket.SendSync(“POST”, url)