Webhook can't pull ip_address


Trying to parse the webhook data.json in php and everything works except I can’t get the ip_address extracted to a variable? Instead of the IP I just get 1 Any ideas?


4 replies

Hey David, sorry you’re running into trouble with that. Can you post the relevant bits of your code?

Hi, I’m not doing anything fancy, just using the script found on the unbounce webook FAQ page, the only thing missing from that script is assigning the IP address. So I can’t get anything but a value of 1 in the IP. I did a postbin.org test and IP is there and the field is ip_adress.

Note in my $form_data I have tried both variations in the script below, neither will let me get IP address.

email[0];
$ip_address = $form_data->ip_address[0];

// Grab the remaining page data…
page\_id = _POST[‘page_id’];
page\_url = _POST[‘page_url’];
variant = _POST[‘variant’];

I think I got it, $ip_address = $form_data->ip_address; I took out the [0] and it works!

Yup, sorry, was going to mention that, didn’t get to it as quickly as you managed to figure it out! The [0] means you’re accessing the item as an array. Most of your form fields are provided as arrays, but the ip address is not…

Reply