Hi All,
I am new to Openfire. Currently installed the version 4.0.2 on Ubuntu 14.04 LTS along side I have the REST API plugin installed.
I am trying to do a simple GET to fetch the current users in the system of which only exists the admin at the moment.
The following is the response I am getting
class Guzzle\Http\Message\Response#1606 (10) {
protected $body =>
class Guzzle\Http\EntityBody#1596 (6) {
protected $contentEncoding =>
bool(false)
protected $rewindFunction =>
NULL
protected $stream =>
resource(1407) of type (stream)
protected $size =>
int(4046)
protected $cache =>
array(9) {
'wrapper_type' =>
string(3) "PHP"
'stream_type' =>
string(4) "TEMP"
'mode' =>
string(3) "w+b"
'unread_bytes' =>
int(0)
'seekable' =>
bool(true)
'uri' =>
string(10) "php://temp"
'is_local' =>
bool(true)
'is_readable' =>
bool(true)
'is_writable' =>
bool(true)
}
protected $customData =>
array(1) {
'default' =>
bool(true)
}
}
protected $reasonPhrase =>
string(2) "OK"
protected $statusCode =>
int(200)
protected $info =>
array(26) {
'url' =>
string(67) "https://127.0.0.1:9091/login.jsp?url=%2Fplugins%2Frest%2Fv1%2Fusers"
'content_type' =>
string(24) "text/html; charset=UTF-8"
'http_code' =>
int(200)
'header_size' =>
int(253)
'request_size' =>
int(187)
'filetime' =>
int(-1)
'ssl_verify_result' =>
int(18)
'redirect_count' =>
int(0)
'total_time' =>
double(0.03786)
'namelookup_time' =>
double(1.4E-5)
'connect_time' =>
double(6.9E-5)
'pretransfer_time' =>
double(0.036041)
'size_upload' =>
double(0)
'size_download' =>
double(4046)
'speed_download' =>
double(106867)
'speed_upload' =>
double(0)
'download_content_length' =>
double(4046)
'upload_content_length' =>
double(0)
'starttransfer_time' =>
double(0.037609)
'redirect_time' =>
double(0)
'redirect_url' =>
string(0) ""
'primary_ip' =>
string(9) "127.0.0.1"
'certinfo' =>
array(0) {
}
'primary_port' =>
int(9091)
'local_ip' =>
string(9) "127.0.0.1"
'local_port' =>
int(43806)
}
protected $effectiveUrl =>
string(67) "https://127.0.0.1:9091/login.jsp?url=%2Fplugins%2Frest%2Fv1%2Fusers"
protected $headers =>
class Guzzle\Http\Message\Header\HeaderCollection#1609 (1) {
protected $headers =>
array(6) {
'date' =>
class Guzzle\Http\Message\Header#1610 (3) {
...
}
'content-type' =>
class Guzzle\Http\Message\Header#1611 (3) {
...
}
'set-cookie' =>
class Guzzle\Http\Message\Header#1612 (3) {
...
}
'expires' =>
class Guzzle\Http\Message\Header#1613 (3) {
...
}
'content-language' =>
class Guzzle\Http\Message\Header#1614 (3) {
...
}
'content-length' =>
class Guzzle\Http\Message\Header#1615 (3) {
...
}
}
}
protected $headerFactory =>
class Guzzle\Http\Message\Header\HeaderFactory#1608 (1) {
protected $mapping =>
array(2) {
'cache-control' =>
string(39) "Guzzle\Http\Message\Header\CacheControl"
'link' =>
string(31) "Guzzle\Http\Message\Header\Link"
}
}
protected $params =>
class Guzzle\Common\Collection#1607 (1) {
protected $data =>
array(1) {
'redirect.count' =>
int(1)
}
}
protected $protocol =>
string(4) "HTTP"
protected $protocolVersion =>
string(3) "1.1"
}
As you can seeā¦ it seems to be redirecting to the login.jsp . I have no idea why. The calling script is super simple.
<?php
public function test() { $openfire = $this->getOpenfire();
$request = $openfire->get('users', array(), array(
'auth' => array('admin', 'zaq12wsx', 'Basic'),
'verify' => false
));
$res = $request->send();
var_dump($res); } ?>
Hopefully someone can offer some insight?
Thanks