我懂一点php,我需要使用API来显示JSON中收到的信息。
文档说的是这样的
POST /v1/auth/open HTTP/1.1
Host: api.owencloud.ru
Accept: */*
Content-Length: 68
Content-Type: application/x-www-form-urlencoded
{
"login":"[email protected]",
"password":"password123"
}
但我不明白如何使用它。文档本身位于https://api.owencloud.ru/
我尝试了这个,但它出现了一个空白页。而且我不明白这个算法是做什么的。
$dataString = '{
"login":"[email protected]",
"password":"password123"
}';
$url = 'https://api.owencloud.ru/v1/auth/open';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'POST /v1/auth/open HTTP/1.1',
'Host: api.owencloud.ru',
'Accept: */*',
'Content-Length: 68',
'Content-Type: application/x-www-form-urlencoded'
]);
$result = curl_exec($ch);
echo $result;
curl_close($ch);
我至少想要一些例子,然后我自己做