GO API

Talk about anything that doesn't fit in the other catagories :) (and of course is about Group-Office)

Moderator: Developers

gtech
Posts: 31
Joined: Thu Aug 05, 2010 5:44 pm

GO API

Postby gtech » Thu Jan 27, 2011 7:46 pm

I am trying to tie into the GO API in order to add/remove users. I am trying to do so with a specific config.php since I run the servermanager module. I have the following code which does not work. I believe the problem to be that it's ignoring the config.php that I am supplying:


<?php

require("/etc/groupoffice/test1.com/config.php");
chdir("/usr/share/groupoffice/modules/users");

require_once("../../Group-Office.php");
require("classes/users.class.inc.php");
require_once($GO_CONFIG->class_path.'base/auth.class.inc.php');

$GO_AUTH = new GO_AUTH();
$out=$GO_AUTH->login("admin", "test1");

?>

Any ideas ?
mschering
Site Admin
Site Admin
Posts: 8339
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: GO API

Postby mschering » Tue Feb 01, 2011 10:00 am

What's the error and purpose of this code?
Best regards,

Merijn Schering
Intermesh
gtech
Posts: 31
Joined: Thu Aug 05, 2010 5:44 pm

Re: GO API

Postby gtech » Wed Feb 02, 2011 6:13 am

There is no error. The problem is that it ignore the custom config.php file I am specifying. It still uses the default config.php for the 'main' server.

I want to have it use the config.php for the specified domain.

I then want to call API methods for adding/removing users into that domain.
mschering
Site Admin
Site Admin
Posts: 8339
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: GO API

Postby mschering » Thu Feb 03, 2011 11:50 am

use

Code: Select all

define('CONFIG_FILE', '/path/to/config.php');
before require(Group-Office.php);
Best regards,

Merijn Schering
Intermesh
gtech
Posts: 31
Joined: Thu Aug 05, 2010 5:44 pm

Re: GO API

Postby gtech » Thu Feb 03, 2011 5:33 pm

this works beautifully!

thanks!

note: A quick example section on the online API would be very helpful. The code above was cropped together after many trials & errors

Who is online

Users browsing this forum: No registered users and 4 guests