# Particle Webhook to PHP URL problems

**URL:** <https://community.particle.io/t/particle-webhook-to-php-url-problems/24375>\
**Category:** Troubleshooting\
**Created:** [July 14, 2016, 2:10pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375 "2016-07-14T14:10:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Len](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Len](https://community.particle.io/u/Len)\
**Post date:** [July 14, 2016, 2:10pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/1 "2016-07-14T14:10:46Z")

</div>

I’ve set up a Particle.publish from my Photon like so:

```
sprintf(publishString, "{\"location\": %u, \"aRead\": %u}", location, aRead);
Particle.publish("trap", publishString);

```

I want the data of location and aRead to be inserted into a php link like so: …/RegisterValues.php?locationId={location}?value={aRead}

I’ve set up a webhook in Particle in many different ways, but I just can’t get it to post the data into my database.

I’ve tried Full URL: …/RegisterValues.php and changing the parameters in the publish string to that of my database columns. I’ve tried the FORM and Query input, but I just cannot get it to work. My current setup is like this: [image](http://i.imgur.com/R70IN31.png)

What I want to happen is the data from my publish string {{location}} and {{aRead}} is being placed in my phpmyadmin database under controllerId and value respectively.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [July 14, 2016, 2:38pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/2 "2016-07-14T14:38:39Z")

</div>

I would use the query parameters and set:

```auto
controllerId={{aRead}}
value={{location}}

```

There are some tips of using Mustache templates in query arguments in this tutorial:

> [@Webhook intermediate tutorial](https://community.particle.io/t/webhook-intermediate-tutorial/23892):
>
> I made an webhook tutorial that goes into more depth on defining them in JSON, using Request Bin for debugging, and using Mustache templates on requests and responses. It’s up on Github here: There are a lot of pictures which would have been a pain to upload directly into a post, plus you can submit corrections and suggestions using issues and pull requests there easily.

---

<div class="post-metadata">

**Author:** ![Len](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Len](https://community.particle.io/u/Len)\
**Post date:** [July 14, 2016, 2:44pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/3 "2016-07-14T14:44:30Z")

</div>

I’ve already done this under query, but this doesn’t give me

```
controllerId={{location}}
value={{aRead}}

```

but

```
{
  "controllerId" : "location"
  "value" : "aRead"
} 

```

I’ll experiment with getting your code into the webhook and I’m gonna check out your tutorial now.

---

<div class="post-metadata">

**Author:** ![Len](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Len](https://community.particle.io/u/Len)\
**Post date:** [July 14, 2016, 3:07pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/4 "2016-07-14T15:07:26Z")

</div>

I’m completely confused. If I just use the link …/RegisterValues.php?controllerId=2?value=50 in my browser, it inputs these values. But with change the names of the strings in the Particle.publish to fit the right columns in my phpmyadmin database, there’s literally nothing happening…

In requestbin it just shows me what I would expect: `{"controllerId": 2, "value": 6}`.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [July 14, 2016, 3:10pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/5 "2016-07-14T15:10:42Z")

</div>

If you can enter the values in your browser URL bar, you need to be using GET not POST. And set the values as I entered above for query. Include only the part before the ? in the URL for the webhook.

---

<div class="post-metadata">

**Author:** ![Len](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Len](https://community.particle.io/u/Len)\
**Post date:** [July 14, 2016, 3:11pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/6 "2016-07-14T15:11:57Z")

</div>

So, as `controllerId={{location}}` opposed to `"controllerId" : "location"`?

And going to try that now.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [July 14, 2016, 3:14pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/7 "2016-07-14T15:14:21Z")

</div>

Wait, how are you entering these values? In the graphical UI, the custom JSON tab, or using the CLI?

---

<div class="post-metadata">

**Author:** ![Len](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Len](https://community.particle.io/u/Len)\
**Post date:** [July 14, 2016, 3:16pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/8 "2016-07-14T15:16:02Z")

</div>

I am using [https://dashboard.particle.io/user/integrations](https://dashboard.particle.io/user/integrations) to create the webhook. Been using the interface the most since I have no experience with JSON and I figured this was going to be an easy task, I was a bit wrong about that.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [July 14, 2016, 3:20pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/9 "2016-07-14T15:20:00Z")

</div>

This is what I meant:  
 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/e/e6fac2b6ed8d84717253f821a68928223e65938b.png)

---

<div class="post-metadata">

**Author:** ![Len](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@Len](https://community.particle.io/u/Len)\
**Post date:** [July 14, 2016, 3:23pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/10 "2016-07-14T15:23:09Z")

</div>

It worked! And I found a problem as well, the documentation of the input values had a mistake. It was controllerid, not controllerId…

Anyway, super thanks for your help. I don’t think I would’ve known about the GET instead of the POST. 😄

---

<div class="post-metadata">

**Author:** ![hoosier](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@hoosier](https://community.particle.io/u/hoosier)\
**Post date:** [March 18, 2017, 6:04pm UTC](https://community.particle.io/t/particle-webhook-to-php-url-problems/24375/11 "2017-03-18T18:04:48Z")

</div>

@Len Hi! I’m hoping you could provide some direction…  
I’ve got the webhook running - it’s returning a url in the webhook console ‘HTTP Response’.  
I can use json\_decode to display my sensor data on the php page if I manually append the hook response url to my hosted php url.

I’m at a loss for what happens next - how are you using the webhook to update your DB in phypmyadmin?

Thanks for any help you can give!
