我试图在标头上接受以下请求:application / json 内容类型:application / json
{
"userVO": {
"userId": "899",
"lstAuthToken":" uYCpPz6LTYVAZBee8S2cy5ZwFk%3D"
}
}
发送到以下URL:http://54.84.41.76/wkconnects/rest/manageLST/validateLSTAuthToken进行验证。 我将得到以下答复:
{
"ccVerified": "true",
"sessionAuthenticationToken": "KAA93bndyYaVPCVa8Sx%2FqLomPUP0CSBVHLRBQKMy3e9N%2FnYBEdjXHoN0lmxLfRwljH3PpkeOLIYS%0AQ4WVhF14015bz22HOAq%2B%2FBzMfzI3Z3jFmcuPDhZ6UGGv691Q1azHuQq8U7Biz8DSkPZV0qznohjD%0A43AhVR03LLFcffHI3do%3D",
"status": "true"
}
我需要获取响应ccVerifiedand sessionAuthenticationToken作为变量,以便我可以说= true或= false等。
我尝试使用以下方法收效甚微:
<?php
$client = new GuzzleHttp\Client();
$res = $client->get('http://54.84.41.76/wkconnects/rest/manageLST/generateLSTAuthToken', [
'auth' => ['899', 'uYCpPz6LTYVAZBeH9Xfi%2F2cy5ZwFk%3D']
]);
echo $res->getStatusCode(); // 200
echo $res->getHeader('content-type'); // 'application/json; charset=utf8'
echo $res->getBody(); // {"type":"User"...'
var_export($res->json());
?>
答案 0 :(得分:1)
对不起,我大部分时间都是在卷曲的情况下做
.exe