ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to receive third party POST data

July 22, 2014 7:02am

Subscribe [1]
  • #1 / Jul 22, 2014 7:02am

    AlteredState

    57 posts

    Hi

    I’m having a third party POST data to a URI in my EE site automatically on an order completion.

    I know how to manipulate the data once I’ve got it, but I don’t know how to code the receiving file/template.

    I currently have the following PHP in an EE template to receive the data:

    <?php
     $salt  = '123456abcdef';
     $order_src = 'source_name';
     $chk_order_key = sha1($order_src.$salt);
     $order_key  = ee()->input->post('order_key', FALSE);
     $order_ref  = ee()->input->post('order_ref', TRUE);
     $order_value  = ee()->input->post('order_value', TRUE);
     $order_name = ee()->input->post('order_name', TRUE);
     $order_ip  = ee()->input->post('order_ip', TRUE);
    
     if($order_key!=$chk_order_key)
     {
      echo 'failed';
     } else {
      echo 'success!';
     }
    ?>

    ...but testing with a form just throws up an EE error - presumably relating to the lack of an XID on submit.

    So, do I need to setup a separate standalone PHP file to receive the data and insert the data into the EE database outside of EE? Or do I need to create an EE module or something?

    I’m not sure what to do, so any help would be appreciated 😊

    Thanks
    Steve

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases