JSON REST request with PHP response as variable

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

JSON REST request with PHP response as variable



I am trying to get the following request on headers Accept: application/json
Content-Type: application/json



"userVO":
"userId": "899",
"lstAuthToken":" uYCpPz6LTYVAZBee8SHrB9I1Ak2nxH9Xfi%2F2cy5ZwFk%3D"




sent to the URL of the following: http://54.84.41.76/wkconnects/rest/manageLST/validateLSTAuthToken for validation.
I will get the response of:



"ccVerified": "true",
"sessionAuthenticationToken": "KAA93bndyYaVPCVa8Sx%2FqLomPUP0CSBVHLRBQKMy3e9N%2FnYBEdjXHoN0lmxLfRwljH3PpkeOLIYS%0AQ4WVhF14015bz22HOAq%2B%2FBzMfzI3Z3jFmcuPDhZ6UGGv691Q1azHuQq8U7Biz8DSkPZV0qznohjD%0A43AhVR03LLFcffHI3do%3D",
"status": "true"



I need to get the response ccVerifiedand sessionAuthenticationToken as variables so I can say =true or =false etc.



I tried using the following with little success:


<?php
$client = new GuzzleHttpClient();
$res = $client->get('http://54.84.41.76/wkconnects/rest/manageLST/generateLSTAuthToken', [
'auth' => ['899', 'uYCpPz6LTYVAZBee8SHrB9I1Ak2nxH9Xfi%2F2cy5ZwFk%3D']
]);
echo $res->getStatusCode(); // 200
echo $res->getHeader('content-type'); // 'application/json; charset=utf8'
echo $res->getBody(); // {"type":"User"...'
var_export($res->json());
?>









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

PySpark count values by condition

Mass disable jenkins jobs