Anonymous commented on API Debugging Cheatsheet
Hey,
I’m working on testing out an app idea with webhooks using php and I am having a bit of an issue. I am running it on my localhost (xampp / php enabled server) and wondering if the code published here https://gist.github.com/amwelles/5165395#file-webhooks-php no longer works with the webhooks API or if its a cross site domain error on my end.
The error I am getting is Notice: Undefined index: payload in https://localhost/ran/webhooks.php on line 14
There are other errors but I am certain they are all coming from this initial error. Below is my code which isn’t very different from the github.
posted 2014-05-16 15:44:41 -0700
I’m working on testing out an app idea with webhooks using php and I am having a bit of an issue. I am running it on my localhost (xampp / php enabled server) and wondering if the code published here https://gist.github.com/amwelles/5165395#file-webhooks-php no longer works with the webhooks API or if its a cross site domain error on my end.
The error I am getting is Notice: Undefined index: payload in https://localhost/ran/webhooks.php on line 14
There are other errors but I am certain they are all coming from this initial error. Below is my code which isn’t very different from the github.
<?php <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24data" title="$data">$data</a> = $_REQUEST["payload"]; $unescaped_data = stripslashes($data); <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24obj" title="$obj">$obj</a> = json_decode($unescaped_data); <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24fname" title="$fname">$fname</a>=$obj->signup-&gt;first_name; <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24lname" title="$lname">$lname</a>=$obj-&gt;signup-&gt;last_name; <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24nid" title="$nid">$nid</a>=$obj-&gt;signup-&gt;nationbuilder_id; $address1=$obj-&gt;signup-&gt;address-&gt;address1; $email1=$obj-&gt;signup-&gt;email1; <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24signup" title="$signup">$signup</a>=$obj-&gt;signup; //Insert into DB <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24con" title="$con">$con</a> = mysql_connect("localhost","NB-Admin","*****"); mysql_select_db("targets-test", <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24con" title="$con">$con</a>); $sqltable = "CREATE TABLE IF NOT EXISTS webhook_signup (first_name varchar(15), last_name varchar(15), nationbuilder_id int, address1 varchar(20), email1 varchar(30) )"; $sqlinsert = "INSERT INTO webhook_signup (first_name, last_name, nationbuilder_id, address1, email1) VALUES ('$fname','$lname', '$nid', '$address1', '$email1')"; $sqlupdate = "UPDATE webhook_signup SET first_name='$fname', last_name='$lname', address1='$address1', email1='$email1' WHERE nationbuilder_id=$nid"; $sqlquery = "SELECT nationbuilder_id FROM webhook_signup WHERE nationbuilder_id='$nid' LIMIT 1"; $nidtest1 = mysql_query($sqlquery, <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24con" title="$con">$con</a>); <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24row" title="$row">$row</a> = mysql_fetch_row($nidtest1); $nidtest = <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24row" title="$row">$row</a>[0]; if($nidtest == <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24nid" title="$nid">$nid</a>){ mysql_query ($sqlupdate, <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24con" title="$con">$con</a>); }else{ mysql_query ($sqltable, <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24con" title="$con">$con</a>); mysql_query ($sqlinsert, <a class="tweet-url cashtag" href="https://twitter.com/#!/search?q=%24con" title="$con">$con</a>); } ?&gt;