我正在使用以下 cURL 请求访问本地主机,一切正常:
curl -u admin:e4d4face52f2e3dc22b43b2145ed7c58ce66e26b384d73592c -d "{\"jsonrpc\": \"2.0\", \"method\": \"feed.list\", \"id\": 1}" http://localhost/minifluxR/jsonrpc.php
但是当我使用Postman而不是cURL发送相同的请求时,我得到了:
{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"Parse error"}}
在 Postman 中,我使用了 GET
请求,并将以下内容作为标头发送:
url:http://localhost/minifluxR/jsonrpc.php
username:admin
api_token:e4d4face52f2e3dc22b43b2145ed7c58ce66e26b384d73592c
method: feed.list
以下是我正在尝试触发的PHP函数:
$server = new Server;
$server->authentication(array(
\Model\Config\get('username') => \Model\Config\get('api_token')
));
// Get all feeds
$server->register('feed.list', function () {
return Model\Feed\get_all();
});
请帮助我纠正这些错误。
curl --no-check-certificate https://localhost:8000/login \ -d username=myusername \ -d password=mypassword \ -d eauth='pam'
我已经将它们作为参数添加了,但不起作用。 - Mostafa Hussein