How to get published data with Webhook+PHP?

Hello,
I’ve been working towards sending information from my photon into a SQL database, referencing various threads on the forum. I made a webhook, and I have a PHP page which can successfully insert to the database. The problem is that I can’t seem to access the information which I am trying to publish.

I want to be able to send multiple pieces of information, but I’m currently just trying to insert the data as a whole. Could someone point out what I could be doing wrong? When the row is added to the database, the value for $data ends up being empty.

I currently have a IFTTT applet that takes the published data and puts it in a google docs spreadsheet, so here’s what actually gets published if it is useful information.
{“device”:Test_Unit, “sessionid”:11}

I followed this guide https://github.com/rickkas7/particle-webhooks along with many other threads but have not had any success yet.

If anyone has some advice, I would greatly appreciate it.

Hey flonch,
I’m in the same boat as you!
I wanted to see if you ever got anything to work.

The few threads on this topic seem like the solution is very simple, but apparently I’m missing something.

Sorry I don’t have any answers for you -
just wanted you to know you’re not the only one struggling with this.
If you figure it out, please let me know!

You have to format the string you are publishing as JSON, then just make a basic webhook that uses POST, and decode the data in PHP.

String json = "{\"e\": \"Upload\", \"d\": \"" + deviceName + "\", \"v\": \"" + String(VERSION) + "\", \"c\": \"" + String(counter) + "\", \"tt\": \"" + String(totalTime) + "\"}";
Particle.publish("Pulse", json, 120, PRIVATE);
<?php $data = $_POST['data']; $json = json_decode($data); $device = $json->{'d'}; ...

Hi again @flonch,
Thanks for responding so quickly the other night!
I’ve been working with what you told me, but am getting “NULL” returned on the PHP page.
Could you take a look at my code?
This is the webhook:

{
    "eventName": "count",
    "url": "my_website.php",
    "requestType": "POST",
    "json": {
    	"value": "{{count}}"
    },
    "mydevices": true,
	"noDefaults": true
}

This is the PHP I have hosted - when using var_dump, it returns NULL.

$data = $_POST['data'];
$json = json_decode($data);
$count = $json->{'c'};
var_dump($count);

And here’s a screen shot of my particle’s voidloop with publish and the json formatted string:

Any more advice would be greatly appreciated!

You want to use {{c}} as this is the key name you used in your JSON - count is just the event name that triggers the webhook.

As far as the webhook goes, I just used the webhook builder. Just enter the event name, and the URL, also make sure it is on POST.
The PHP and your particle code seem fine though.