【发布时间】:2015-11-16 22:46:01
【问题描述】:
我有 XMPP 服务器 openfire。 我还添加了“rest api 插件”并使用 Chrome 工具“Postman”对其进行了测试,效果很好。
请求:
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":"Internal server error."}
然后我尝试使用 php 脚本获取请求:
$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)
我做错了什么? 谢谢
【问题讨论】: