Wednesday, May 13, 2015

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";
}

8 comments:

  1. 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

    ReplyDelete
  2. 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.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Thanks for your sharing. Hope you can contribute more quality posts to this page. Thank you!
    despacito lyrics , color switch

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. AVG Retail is unprecedented contrasted with different Antivirus programming. Customer can download the item from www.avg.com/retail.The item gives the all out suite of the features which can confirm your database from your devices. The item guarantee you just as control the deterrent of your system avg.com/retail it will improve the speed of your structure using the structure upgrade mechanical assembly.

    ReplyDelete
  7. AVG Retail is extraordinary compared to other Antivirus programming. Client can download the product from avg.com/retail. www.avg.com/retail
    . The product gives the total suite of the highlights which can verify your database from your gadgets. The product ensure you as well as control the obstruction of your framework it will improve the speed of your framework utilizing the framework enhancement apparatus.

    ReplyDelete
  8. AVG Retail is exceptional contrasted with different Antivirus programming. Customer can download the item from www.avg.com/retail
    . The item gives the complete suite of the features which can confirm your database from your contraptions. Avg.com/retail item guarantee you just as control the check of your system it will improve the speed of your structure using the system upgrade mechanical assembly.

    ReplyDelete