0

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.

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28
Ron Nucum
  • 31
  • 5

1 Answers1

1

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
GullDe
  • 390
  • 2
  • 12
  • Hello, The response I'm getting is thru email using the plugin 3rd-party-integration. I am not sure how to put that on a variable since I'm not sure where to get it since it's a debug notification thru email. Sorry. Thanks! – Ron Nucum Jun 16 '17 at 06:22