I’m still having fun trying to get any success with Infinity Free’s service.
I have success with another hosting service and have the same code here on Infnity Free. My browser correctly reads the db for both services, but when I attempt to put the data into Infinity’s db, Infinity’s server seems to return “Content-Type: text/html” whereas the successful service returns “Content-Type: application/json; charset=UTF-8”. I am using an ESP8266 to populate the db and the feedback is parsed in the Arduino IDE’s monitor.
Interestingly, if that’s the right word, I couldn’t even get Filezilla to connect to Infinity today either, whereas I could with my other service.
If anyone has the answer I’d be grateful to hear, as I’d like a second service - if it has a chance of working reliably.
If I may, I’ll focus on the problem of populating the database (one row at a time incedentally), as I think the Filezilla thing is secondary to me.
The following is returned by the other server after a succesful insert of a row into the db:
connecting to my.webapp.com
Requesting URL: /MSB/api/insert.php?v=300&b=2&w=4378&c=70
HTTP/1.1 200 OK
Date: Fri, 04 Feb 2022 21:02:48 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 64
Connection: close
Access-Control-Allow-Origin: *
Server: awex
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Request-ID: 6b2f28edaed3e2cf09ca6510615bc2b2
{“success”:1,“message”:“Controller state successfully created.”}
closing connection
The difference with the Infinity Free response is that the Content-Type is reported as being: text/html. I’m thinking that maybe I need to somewhere tell Infinitys server that it is returning a particular type, but I’m not sure where to put this.
You can change the content type by putting a header at the first line of your code (after the <?php of course). This will change it to JSON: header('Content-Type: application/json');
Without appearing too protectionistic, I was trying to keep the site private because it is just for me and currently has no password system. It’s not my.webapp.com. In future I would like to add a password too and so I’d be gratefil if you were to advise whether this is posible with this service and if there are any abnormal configurations necessary.
With respect to the header declaration at the top of a php page, this is what I already have, unfortunately.
I don’t have an alternatve way of updating the table from the one that I use as far as I can see and so I think that’s a deal breaker. Nevermind, it was interesting to discover some of the limitations of free accounts.