Still no success with db and json

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.

Many thanks!

There was a mini-outage earlier, but is has been fixed. Can you share the logs?

As for the rest, I’m not sure I understand. Could you provide some code as well?
Thanks!

2 Likes

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.

Thanks again.

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');

Ok.

Can you please share…

  • The full and exact URL of the page creating the connection
  • Your domain name (I’m assuming its my.webapp.com but I could be wrong)
  • The name of the database

Thanks!

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.

Thanks a lot!

Adding a password is quite easy! You can use the “Directory Privacy” feature in the control panel. Since it uses htaccess, it is super secure as well.

If you don’t want to share that’s fine, but can you answer…

Is the domain that the request is coming from on the same hosting account as the one that has the database on it?

Thanks

1 Like

Good to hear about the passowrd ease…

When you say “the request”, do you mean the insertion request, or the retrival of row/s request?

Either way, neither request is on the same domain - if I understand correctly. I use two (home and work) and neither is registered with Infinity.

Ah. I think this is the issue then.

2 Likes

Thanks for looking into that for me.

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.

I’ll finally pull the plug and thanks again.

1 Like

Please note that we provide website hosting only, i.e. hosting for things that produce web pages to be consumed in browsers.

API hosting, data storage hosting and so on are not allowed here, and won’t work because of this system:

4 Likes

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