We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Problem with Processing POST Data from Webhook

Development and Programming

blendimc's avatar
blendimc
150 posts
15 years ago
blendimc's avatar blendimc

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's avatar
blendimc
150 posts
15 years ago
blendimc's avatar blendimc

Ok. So i figured out the problem. I need to somehow authorized the Formstack form to post in that channel from the Module. Any Suggestions?

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
15 years ago
John Henry Donovan's avatar John Henry Donovan

blendimc,

I am going to move this thread to the Development and Programming for you as it is more suitable there

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.