1

I need to get the parameters from a http post url sent to my site and use the data to create a new entry in Expressionenegine.

0

You need to use the Channel Entries API. This will allow you to programatically create new Channel Entries.

https://ellislab.com/expressionengine/user-guide/development/api/api_channel_entries.html

The correct way to do it would be to create a custom module, and then have wherever this data is coming from ping that ACTion url.

https://ellislab.com/expressionengine/user-guide/development/module_tutorial.html

Make sure when you do your database inserts for your ACTion ID, you make sure to set the csrf_exempt column to 1, otherwise you will not be able to post to your website from a different domain. HOWEVER, you MUST replace that protection with something else. The simple thing would be to use something akin to an API key. Here's an example to run with for you custom module:

class My_module 
{

    $channel_id = "666";

    function __construct()
    {
        // instantiate your channel entries api
        ee()->load->library('api');
        ee()->api->instantiate('channel_entries');
    }

    function my_module_method_for_making_channel_entries()
    {
        // bail if you don't get your trusted api key
        if ( ee()->input->post('api_key') != 'random_api_key_youll_make_up' ) 
        {
            show_404();
        }

        // go ahead an use the channel entries api
        $title = ee()->input->post('title');
        $data = array("title" => $title);

        // save entry
        ee()->api_channel_entries->submit_new_entry($this->channel_id, $data);
    }
}
1
  • Thank you jrothafer, this worked exactly as i asked, except i had to use save_entry instead and also add session data. however the script does empty previous data when updated with only some of the fields filled in. – Ralph Oct 2 '15 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.