First make sure that CiviCRM is installed and enabled, then use the following. Check the CiviCRM directory under examples for more code that allows you to control every aspect of CiviCRM. This example is using the v3 API. This example simply creates an event within CiviCRM using the information provided.
[notice]We provide CiviCRM/Drupal development and support for $50.00/hr AUD/CAD/USD. Please contact us if you might be interested, we’ll tell you if we can solve your problems within your budget![/notice]
[php]if ( ! civicrm_initialize( ) ) {
return;
}
$params = array(
‘title’ => ‘Annual CiviCRM meet’,
‘summary’ => ‘If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now’,
‘description’ => ‘This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues’,
‘event_type_id’ => 1,
‘is_public’ => 1,
‘start_date’ => 20081021,
‘end_date’ => 20081023,
‘is_online_registration’ => 1,
‘registration_start_date’ => 20080601,
‘registration_end_date’ => ‘2008-10-15’,
‘max_participants’ => 100,
‘event_full_text’ => ‘Sorry! We are already full’,
‘is_monetory’ => 0,
‘is_active’ => 1,
‘is_show_location’ => 0,
‘version’ => 3,
);
require_once ‘sites/all/modules/civicrm/api/api.php’;
$result = civicrm_api( ‘event’,’create’,$params );
[/php]