gnello / php-openfire-restapi Goto Github PK
View Code? Open in Web Editor NEWA complete PHP client for the Openfire REST API Plugin.
License: Apache License 2.0
A complete PHP client for the Openfire REST API Plugin.
License: Apache License 2.0
I tried connecting this way:
`<?php
include "vendor/autoload.php";
$api = new \Gnello\OpenFireRestAPI\API();
//Set the required config parameters
$api->Settings()->setSecret("YWRtaW46YWRtaW4");
$api->Settings()->setHost("localhost.localdomain ");
$api->Settings()->setServerName(" localhost.localdomain ");
//Default values
$api->Settings()->setPort("9090");
$api->Settings()->setSSL(false);
$api->Settings()->setPlugin("/plugins/restapi");
$api->Settings()->setDebug(true);
$requests = \Gnello\OpenFireRestAPI\Debug\Request::getRequests();
var_dump($requests);
`
When I var_dump requests it shows empty,
$payload = new \Gnello\OpenFireRestAPI\Payload\ChatRoom();
$payload->setRoomName('myfirstchatroom');
$payload->setNaturalName('my_first_chat_room');
$payload->setDescription('This is my first chat room!');
$payload->setAdmins(array('admin'));
$payload->setOutcastGroups(array('outcast1','outcast2'));
$payload->setCanAnyoneDiscoverJID(false);
$payload->setCanOccupantsChangeSubject(false);
$payload->setPassword('12345');
$result = $api->ChatRooms()->createChatRoom(payload);
I found error:
Fatal error: Class 'Gnello\OpenFireRestAPI\Payload\ChatRoom' not found in /opt/lampp/htdocs/openfire/application/controllers/api/V1.php on line 40
i found chatroompayload.php file in payload but it has also a big error
Message: Undefined offset: 0
Filename: Payloads/AbstractPayload.php
Line Number: 28
I don't know what is the error.
Please find and fix the error.
Class 'Client' not found in configure the Client and basic HTTP Authentication.
$response = $api->ChatRooms()->retrieveChatRoom('room_' . $e->data->id);
In case the room does not exist it returns an object with default values, but roomName, naturalName and description are 'room_78' for example.
So to check the room exists I have to use workaround:
if ($response['response'] == 1 && $response['output']->roomName !== $response['output']->naturalName) {
Can we add rolesToBroadcast value in database while creating the room
Thanks!
Below the only way to create a group with members:
$api->ChatRooms()->createChatRoom($payload);
$payload->setMembers($members);
$api->ChatRooms()->updateChatRoom('group_' . $e->data->id, $payload);
You cannot open chat room in a client if a room is created with members. I think if this is not a bug at least this needs clarification in API docs
I am trying to add in laravel 8 project and got this error.
Problem 1 - Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.1.1]. - Can only install one of: guzzlehttp/guzzle[7.1.1, 6.5.x-dev]. - Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.1.1]. - gnello/php-openfire-restapi 3.0.0 requires guzzlehttp/guzzle ^6.2 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev]. - Installation request for gnello/php-openfire-restapi ^3.0 -> satisfiable by gnello/php-openfire-restapi[3.0.0]. - Installation request for guzzlehttp/guzzle (locked at 7.1.1, required as ^7.0.1) -> satisfiable by guzzlehttp/guzzle[7.1.1].
Hi,
I am not able to create the room and even I'm not able to add user in the openfire through the script
below I have added the response.
getRequest -- [{"url":"http://144.217.253.67:9009/plugins/restapi/v1/chatrooms?servicename=conference","headers":["Accept: application/json","Authorization: basic YWRtaW46aW50ZWxueHQyMDE3IQ==","Content-Type: application/json"],"method":"POST","postData":"{"roomName":"intellinects","naturalName":"12334545","description":"This is my first chat room!","persistent":true,"canAnyoneDiscoverJID":false,"canOccupantsChangeSubject":false,"broadcastPresenceRoles":{"broadcastPresenceRole":["moderator","participant","visitor"]},"admins":{"admin":["admin"]}}","response":false,"server_output":""}]
getCurlInfo -- {"url":"http://144.217.253.67:9009/plugins/restapi/v1/chatrooms?servicename=conference","content_type":null,"http_code":302,"header_size":325,"request_size":522,"filetime":-1,"ssl_verify_result":0,"redirect_count":0,"total_time":0.594,"namelookup_time":0,"connect_time":0.25,"pretransfer_time":0.25,"size_upload":295,"size_download":0,"speed_download":0,"speed_upload":496,"download_content_length":0,"upload_content_length":295,"starttransfer_time":0.594,"redirect_time":0,"redirect_url":"http://144.217.253.67:9009/login.jsp?url=%2Fplugins%2Frestapi%2Fv1%2Fchatrooms%3Fservicename%3Dconference","primary_ip":"144.217.253.67","certinfo":[],"primary_port":9009,"local_ip":"192.168.0.103","local_port":54040}
please help me.
Thanks!
I have use following code for create chat room
$payload = $api->Payloads()->createChatRoomPayload();
$payload->setRoomName('test_1');
$payload->setNaturalName('est_1');
$payload->setDescription('This is my first chat room!');
$result = $api->ChatRooms()->createChatRoom($payload);
after get success message if I have check in admin console then it's show
but when I check it in my MYSQL database it's not added
after restart openfire server it's deleted
would you please guide me what I need to do?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.