I am using Formstack and wanted to integrate their Webhook functionality into EE so I could have EE Process the data that the form posts. So I created a module and added an action for the module. I’m then setting the form to POST the data to domain.com/?ACT={ACTION_ID]. If i do a normal form, the following code works fine, but the webhook doesn’t. I’m wondering if its because the form actually loads the page whereas the POST only post data to the url or am I completley off? Funny thing is, If i have the script send me an email, it will when I submit the Formstack Form, but only if the mail() function is placed before the Submit_new_entry() call. Is somehow $this->EE not getting loadded on a POST?
Is there an easier way to accomplish what I am trying to do (ie, have formstack POST data to ee and have it process the form)?
(The reason I’m using formstack is because its a quick job that needs Credit card functionality and I don’t have time/need to integrate credit card into EE, So im just using Formstack’s built in Authorize.net Feature).
class Formstack {
var $return_data = '';
var $p_limit = '';
function Formstack()
{
// Make a local reference to the ExpressionEngine super object
$this->EE =& get_instance();
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_entries');
}
function processForm(){
// The message
$channel_id = 6;
$data = array(
'entry_id' => 0,
'title' => 'Test',
'entry_date' => time()
);
try {
$this->EE->api_channel_entries->submit_new_entry($channel_id, $data);
} catch (Exception $e) {
$error = 'Caught exception: ', $e->getMessage(), "\n";
mail("[email protected]","test - $error",$error);
}
}blendimc,
I am going to move this thread to the Development and Programming for you as it is more suitable there
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.