Post to website on app open.

I have a system service app and I need to post a single variable to a php script to run on app open. I’ve noticed that if a firewall is blocking or the php script fails then the system service app doesn’t open. It flashes a quick error message and crashes. Is there a more reliable way to post a var to a php script on app open than the way I am currently doing this? Thanks!

My initialize method:

  Dim d As New Dictionary
  Dim sckHTTP As New SckHTTP
  WriteStatus "Initialize!!!"
  d.Value("ID") = ID
  SckHTTP.Post(gstrURL + "initialize.php")

Is the Error event handler of your SckHTTP class getting called?

No I admit I am new to using SckHTTP and I am not implementing the error handler. I guess I should dig through the examples unless you have a quick one to share with me? Thanks!

Well, SckHTTP is not a built-in class. That would imply you have subclassed it. If so, you can just add the Error event handler to the subclass and put some code there to maybe help diagnose the problem.

There are several HTTP examples included with Xojo.


Yeah I have subclassed it. I was just looking at the HTTPSocketPost Example and it doesn’t include an example for the Error handler.

Thanks Paul I found an example that posts the error code.

Sorry I meant to say HTTPSocket not SckHTTP I see what you were referring to now…

could you change sckHTTP to a property of webpage/window, so it survives the method end?

It’s a system service app I don’t think I can do that can I?

Post method runs async anyway.

else you need to pass parameter for timeout to make it the function call which waits.

Even in service app it should work.

The timeout is a good idea I was just looking into that thanks.

Just out of curiosity, is the URL that you are posting to http or https? If it’s the latter, you’ll need to subclass from HTTPSecureSocket.

It’s not https, but thanks.