Connect your website to Group-Office

Often it's desired to connect a website to Group-Office. For example you might want to have a sign up form that adds a contact to Group-Office.
Group-Office has a powerful JSON API to do this. Here's an example script that add's a contact using cURL. With cURL you can do HTTP requests in your own PHP script that you can run on your own CMS like Wordpress or Drupal for example.



<?php
//URL to Group-Office. You must use SSL because we use basic auth!
$groupoffice_url = "https://localhost/groupoffice-6.1/www/";

//Group-Office username and password. You should create a restricted user that 
//can only add contacts to this addressbook.
$username = 'website';
$password = 'secret';

//The contact properties to POST
$post = array(
  'addressbook_id' => 1, //required
  'company_id' => 0,
  'first_name' => 'Curl',
  'last_name' => 'Tester',
  'initials' => '',
  'title' => '',
  'suffix' => '',
  'sex' => 'M', // or 'F"
  'birthday' => '', //local format
   'email' => '',
  'email2' => '',
  'email3' => '',
  'department' => '',
  'function' => '',
  'home_phone' => '',
  'work_phone' => '',
  'fax' => '',
  'work_fax' => '',
  'cellular' => '',
  'cellular2' => '',
  'homepage' => '',
  'country' => 'NL', //2 character ISO code 
  'state' => '',
  'city' => '',
  'zip' => '',
  'address' => '',
  'address_no' => '',
  'comment' => ''
);

$process = curl_init($groupoffice_url . '?r=addressbook/contact/submit');
curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $post);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);

$return = curl_exec($process);
curl_close($process);

//JSON decode the response
$json = json_decode($return, true);


//Handle success or error here.
if ($json['success']) {
 echo "Contact saved!\n";
} else {
 echo "Failed to save contact: " . $json['feedback'] . "\n";
}

Comments


  • Mario Stevenson
    August 20, 2015 at 19:46

    Hello,

    That's really not necessary because you can reach the login page from a connection to the World Wide Web. The issue I'm sure which brought this up is "branding." When end-users login into G-O (Intermesh) they should see logos of their own company or employer, not G-O (Intermesh). For instance, if my company is IBM and we used G-O (Intermesh), certainly my employees and officers should see an IBM logo before, during and exiting G-O (Intermesh). ERP solution builders often have this setting as a required default branding. The only party seeing a G-O (Intermesh) logo should be G-O (Intermesh).

    --- MMS


  • StockAim
    September 11, 2015 at 04:06

    Mario, this blog post has nothing to do with what you are talking about. The code simply allows you to create customers when a new user signs up or certain information is entered through any other public website. No login is done.

    But I would agree with you, from a developers perspective the "G-O (Intermesh)" is so engraved, that it is too much work to even change it on the code. Not just the logo, but even the name from certain places. Its nearly impossible. The code is so well encrypted and even the open one its impossible to figure out, I feel like its all obfuscated. Changing the logo is very easy, this thing has Intermesh written on GOTA and everywhere. So going back to your point, you are showing your employees we are using Group Office, how cool is it... Lets face it, only small businesses or up to so many (100) users can efficiently work into this thing, having some support+developer on site. Cool, now i know how Group Office works Boss, ima go open my own company.


  • Markus Baader
    September 26, 2015 at 09:58

    This comment has been removed by a blog administrator.


  • ofis buro mobilyalari
    January 08, 2016 at 15:47

    Thanks for article. Great content!


  • Suseela Susiee
    June 04, 2016 at 09:37



    Really very nice blog information for this one and more technical skills are improve,i like that kind of post.


    SEO Company in Chennai

Back to Top
SourceForge.net Logo