openfire rest api get request is empty


openfire rest api get request is empty

我打开了XMPP-server。此外,我已经添加了"rest api插件",并测试了它与Chrome工具"邮差",它的工作很好。

请求:

http://myhost.net:9090/plugins/restapi/v1/users
头:

Authorization:myPasswort
结果:

{
  "user": [
    {
      "username": "admin",
      "name": "Administrator",
      "email": "info@admin.de",
      "properties": null
    },
  ...

现在我想使用我的作曲应用程序从appgyver.com的结果。相同的输入,但总是服务器结果:

响应码:500。{"error":"服务器内部错误。"}

然后我尝试用php脚本get请求:

$url = "myhost.net/plugins/restapi/v1/users";
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded'r'n",
        'Authorization' => 'myPasswort'
    ),
);
$context  = stream_context_create($options);
var_dump($http_response_header);
echo "'r'n";
$result = file_get_contents($url, false, $context);
var_dump($result);

的结果:NULL bool(false)

我做错了什么?由于

试试下面的php代码片段:

    <?php 
      $url = "http://localhost:9090/plugins/restapi/v1/users";
      $curl = curl_init($url);
      curl_setopt($curl, CURLOPT_HEADER, false);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_HTTPHEADER, array("Accept application/json", "Authorization: PehtV8mbAm5M5MM0"));
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
      $json_response = curl_exec($curl);
      $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
      echo $json_response;
      curl_close($curl);
   ?>

只需更改您的URL和授权密钥