Reputation: 31
The endpoint send a
Response
WP_HTTP_Requests_Response Object
(
[response:protected] => Requests_Response Object
(
[body] => {“status”:”success”,”result”:”112″,”code”:200}
I was trying to get the “result:”112”
Is there a way I can retrieve it?
Thank you. 🙂
Upvotes: 0
Views: 173
Reputation: 390
Refer to the documentation here: https://developer.wordpress.org/reference/classes/wp_http_requests_response/
Assuming the response you are getting (WP_HTTP_Requests_Response) is stored in a variable called $response you should do:
$response_data = json_decode($response->get_response_object()->body);
$result = $response_data->result; // this is the result you want
Upvotes: 1