Azuracast: Generic Webhook generates no data?

Created on 28 Feb 2020  路  2Comments  路  Source: AzuraCast/AzuraCast

Using Docker installation method

Yes

Host Operating System

Ubuntu 16.04

Describe the bug

I've created a php script that is triggered using a webhook when the currently playing song changes. The script takes the raw POST data, encodes it as JSON, then puts that data into a MySQL database. The data should be similar to the Now Playing API, but instead it only contains "[]". There is no station data.

To Reproduce

Expected behavior

Expect webhook to send station data to the script similar to the Now Playing API data.

Relevant Logs

Screenshots

Here's my code.
image

Device(s):

  • Device:
  • OS:
  • Browser:
  • Version:

Additional context

Am I processing the data that comes from AzuraCast incorrectly?
While testing the script via AzuraCast and dumping the POST data to debug, I get this:

Generic webhook returned code 200
response_body
"array(0) {\n}\n"

So it appears that AzuraCast is just sending an empty array.

question wontfix

All 2 comments

@R3troBytz We do include the NowPlaying API entry in the POST body sent via the webhook request, but you don't access that via the PHP $_POST array, you should use something more like:

$data = json_decode(file_get_contents('php://input'));

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings