# HTTPS integration seems not to work properly

**URL:** <https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695>\
**Category:** Application Development\
**Created:** [October 11, 2018, 3:59pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695 "2018-10-11T15:59:45Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dellekom](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/dellekom/32/35857_2.png) [@dellekom](https://www.thethingsnetwork.org/forum/u/dellekom)\
**Post date:** [October 11, 2018, 3:59pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/1 "2018-10-11T15:59:45Z")

</div>

I am having a simple receiver script on [https://www.dellekom.de/input.php](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…

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [October 11, 2018, 4:22pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/2 "2018-10-11T16:22:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dellekom](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/dellekom/32/35857_2.png) [@dellekom](https://www.thethingsnetwork.org/forum/u/dellekom)\
**Post date:** [October 11, 2018, 4:27pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/3 "2018-10-11T16:27:55Z")

</div>

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](https://www.dellekom.de/input.php) obviously

I left the rest blank (no authentication now)

I left the custom fields empty, too.

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [October 11, 2018, 4:32pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/4 "2018-10-11T16:32:08Z")

</div>

> [@dellekom](#):
>
> Access key: default (what does it do

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.

---

<div class="post-metadata">

**Author:** ![dellekom](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/dellekom/32/35857_2.png) [@dellekom](https://www.thethingsnetwork.org/forum/u/dellekom)\
**Post date:** [October 11, 2018, 4:34pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/5 "2018-10-11T16:34:34Z")

</div>

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…?

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [October 11, 2018, 4:35pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/6 "2018-10-11T16:35:41Z")

</div>

> [@dellekom](#):
>
> I did the right thing using the default “default key [devices] [messages]”

Yes, that’s fine.

See some PHP example code in [HTTP integration - #9 by I-Connect](https://www.thethingsnetwork.org/forum/t/http-integration/5271/9) and its replies.

---

<div class="post-metadata">

**Author:** ![dellekom](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/dellekom/32/35857_2.png) [@dellekom](https://www.thethingsnetwork.org/forum/u/dellekom)\
**Post date:** [October 11, 2018, 4:40pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/7 "2018-10-11T16:40:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [October 11, 2018, 5:09pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/8 "2018-10-11T17:09:44Z")

</div>

> [@FYI: TTN HTTP integration with envelope\_with\_arrow Request Baskets instead of RequestBin](https://www.thethingsnetwork.org/forum/t/fyi-ttn-http-integration-with-request-baskets-instead-of-requestbin/11648):
>
> RequestBin (as shown in the [TTN HTTP integration video](https://www.youtube.com/watch?v=Uebcq7xmI1M)) had a lot of performance issues today. Request Baskets: [https://github.com/darklynx/request-baskets](https://github.com/darklynx/request-baskets) or [https://rbaskets.in](https://rbaskets.in) is a very good (and now IMHO even better) alternative. Compared with RequestBin, Request Baskets does: Named baskets Never public (If you want to share the basket, be sure to save the Auth key you get when you create a new Basket!!!) more focus on data with one-click acces to JSON formatted Body content maximum of 2…

[https://alternativeto.net/software/requestbin/](https://alternativeto.net/software/requestbin/)

---

<div class="post-metadata">

**Author:** ![UdLoRa](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/udlora/32/45330_2.png) [@UdLoRa](https://www.thethingsnetwork.org/forum/u/UdLoRa)\
**Post date:** [October 11, 2018, 7:07pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/9 "2018-10-11T19:07:47Z")

</div>

Do you have set a decoder function?

---

<div class="post-metadata">

**Author:** ![dellekom](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/dellekom/32/35857_2.png) [@dellekom](https://www.thethingsnetwork.org/forum/u/dellekom)\
**Post date:** [October 11, 2018, 9:04pm UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/10 "2018-10-11T21:04:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [October 12, 2018, 4:52am UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/11 "2018-10-12T04:52:54Z")

</div>

> [@dellekom](#):
>
> now it WORKS! - maybe because I added ob\_start(); at the beginning of my file

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.

> [@dellekom](#):
>
> Might also be that the HTTP integration sender keeps the connection open so PHP does not start evaluating the request or something?

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!

---

<div class="post-metadata">

**Author:** ![dellekom](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/dellekom/32/35857_2.png) [@dellekom](https://www.thethingsnetwork.org/forum/u/dellekom)\
**Post date:** [October 12, 2018, 9:59am UTC](https://www.thethingsnetwork.org/forum/t/https-integration-seems-not-to-work-properly/18695/12 "2018-10-12T09:59:23Z")

</div>

> [@arjanvanb](#):
>
> That suggests that you’re sending some response to TTN. That’s not needed;

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!
