HTTPS integration seems not to work properly

I am having a simple receiver script on https://www.dellekom.de/input.php running that logs all requests. (Dont go there if you don’t want your IP being logged, although I will delete the stuff soon).

It seems that the Things networks sends a packet every minute which goes well together with the frequency I send packets, but there is no data at all.

Coudl it be that the sender of the HTTP integration can’t post through HTTPS / TLS?

I am using http everywhere certs, however with HSTS…

Might be interesting for anyone…

If it hits your PHP code, then it has connected and TLS is not the issue then. HSTS is not an issue either; it’s up to the client (a browser, or the server side code from TTN) to adhere to that. TTN can safely ignore it, and just use whatever URL you tell it to use.

Ok thanks! I entered in my Things backend:

Access key: default (what does it do? It’s being sent as is is somwhere in the JSON blob, right?

URL: https://www.dellekom.de/input.php obviously

I left the rest blank (no authentication now)

I left the custom fields empty, too.

Above all it grants the integration access to your data. (And yes, it also happens to be included in some URL in the data it posts.) If you’d delete the key at some later time, the integration will no longer be able to see the data. Of course, you trust the TTN-provided integration, but for third-party integrations you might want to create a dedicated key with read-only access.

Ok thanks again - so I assume I did the right thing using the default “default key [devices] [messages]” to allow the integration to fetch my data…?

Yes, that’s fine.

See some PHP example code in HTTP integration - #9 by I-Connect and its replies.

I tried this line

$content = trim(file_get_contents(“php://input”));

but there is no content if I access it via GET or POST.

Correction: There IS content now when using POST, but still: no content coming from TTN.

Unfortunately requestb.in is not available any more.

https://alternativeto.net/software/requestbin/

Do you have set a decoder function?

Yes, I’ve set a decoder function - it yields

{
“ble”: 0,
“pax”: 5,
“wifi”: 5
}

The hint to rbaskets.in was very helpful - data ends up there. Many thanks!

UPDATE: I do not understand why but now it WORKS! - maybe because I added ob_start(); at the beginning of my file. Might also be that the HTTP integration sender keeps the connection open so PHP does not start evaluating the request or something?

That suggests that you’re sending some response to TTN. That’s not needed; TTN will ignore it, and it will also ignore any error message it might see.

No, the PHP script will be executed right away, but it is running into some error while you’re (unintentionally?) sending that response.

Maybe you’re trying to start a session, set a header (Content-Type, HSTS?) or return some cookie after you already outputted some content, and then get a Warning: Cannot modify header information - headers already sent? Even a single newline above your PHP opening tag will already be considered as output. That error is typically “solved” by using ob_start(). But sessions, headers or cookies won’t affect any future request from TTN (the HTTP integration is not a browser), so are not needed at all.

Peek into the PHP error logs if something does not work. And even if it seems to work!

I know, but I don’t send something back I just had this installed to capture the response (errors maybe)

I also did not send cookies or the other stuff you described -

Thank you very much for helping!