PHP Text Sending Has Become Sporadic

I have an Arduino board that monitors the water level in our water coop’s water tank. It will send texts if the water level reaches a predermined low level. This has worked fine until a few days ago - the water level dropped and no warning text was sent. My ears are still burning …

I did some checking on my test board (using the same sketch) and found that the only way texts would be sent is if the includes PHP file was manually opened on the webpage.

Background: I am using T-Mobiles SMS Gateway Domain and have had no issues at all. The internet is overflowing with info that this service has been discontinued but I have found that NOT to be the case. I can receive texts but only if I manually open the PHP file on a webpage.

Again, this issue came to life a few days ago. Previous to this I have never had an issue triggering texts from this water tank app.

All comments and suggestions are most welcome.

Thank you.

P.S. If this is not the appropriate place for this query please feel free to move it. Thanks!

What debugging have you done? Presumably your Arduino code would normally call that same web page to send the text, so what is different? Is the PHP file yours, or someone else’s site that you are calling? If it’s yours, what’s the difference between the Arduino sketch calling it, and you opening it manually, when debug it line by line? Has the server running the PHP code been changed to require a https connection, for example, and your Arduino code is opening a http one? Is the PHP code checking for the user-agent to make sure it’s a browser connection?

@droopsnoot Thank you for you response to my query. I will answer your questions as best I can.

“What debugging have you done?”

I could write a book on this but the things that can prevent a text from being sent from a PHP file are: (1) wrong cell number, (2) wrong SMS Gateway Domain email address and (3) an incorrect PHP file. Each of these has been double-checked and verified. The fact that I can receive the text from this PHP file by simply refreshing a webpage which includes this PHP file tells me that the the PHP file is correctly scripted;

“Presumably your Arduino code would normally call that same web page to send the text, so what is different?'“

Nothing has changed. The MCU in the well house calls the same PHP file as does my workbench Arduino MCU. Here is a code line of one of the PHP files being called by the well house Arduino sketch:

client.println(“POST /includes/north_dailyText.php HTTP/1.1”);

This particular PHP file is in the water coop’s web server website. I created and maintain the website. No one else can access these files;

“Is the PHP file yours, or someone else’s site that you are calling?”

I just answered that above;

“If it’s yours, what’s the difference between the Arduino sketch calling it, and you opening it manually, when debug it line by line?”

There is no difference other than my workbench MCU triggers the PHP file after I comment out all of the maintenance workers cell phone number’s from the PHP file so as not to bother them with my testing;

“Has the server running the PHP code been changed to require a https connection, for example, and your Arduino code is opening a http one?”

I setup the coop’s website as an https site. No one can modify that in any way;

“Is the PHP code checking for the user-agent to make sure it’s a browser connection?”

No. That has not been done. I never thought to do so and should learn to do that.

Lastly, while I have said “nothing has changed …” several times I am aware that something has changed - somewhere, somehow. For the sake of clarity: the well house is on a different wifi/internet service that my workbench/home. I use StarLink. I have no idea what service the well house uses. However, the fact remains that neither MCU can send text messages.

I know I am overlooking something and hope to report back with the solution. Soon.

I sincerely appreciate your help.

What I mean by “what debugging have you done” is “what actually happens when the Arduino code decides it needs to send the text message?” Note that I don’t mean how should it work, how was it designed to work, how did it work before, I mean what does it actually do now?

Does your Arduino code call the PHP code, but the PHP code does not execute? Or does the Arduino code not call the PHP code? If the PHP code starts to execute, how far does it get through the code before it stops executing, when you call it from the Arduino code? This is the way that I would debug the kind of issue you are having - narrow it down to exactly which bit isn’t doing what it should.

I recoded my Arduino sketch to utilize an HTTPS request instead of an HTTP request. This worked. Another good lesson learned.

Thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.