how to hadle response of getPlans()?

Ryan Howard's Avatar

Ryan Howard

11 Nov, 2014 06:11 AM

how to hadle response of getPlans()?

  1. Support Staff 1 Posted by Marc Guyer on 12 Nov, 2014 02:35 PM

    Marc Guyer's Avatar

    Hi Ryan -- This depends on what you want to do. It looks like you just want to get one plan...

    Your call to $response = $client->getPlan() will return a CheddarGetter_Response object which is a DOMDocument. You can do whatever you want to that using the DOM. Or, you can get an array representation with the getPlan() method of CheddarGetter_Response. You could actually do that in one line:

    $plan = $client->getPlan('[your plan code]')->getPlan();
    

    In that example, you're explicitly asking the API to return one plan, then convert that plan to an array.

    Or, you could get all the plans and then extract just the one you want:

    $plan = $client->getPlans()->getPlan('[your plan code]');
    

    In that example, you're asking the API for all of the plans, then using the getPlan() method of the response object to extract just the one plan.

  2. Marcela Poffald closed this discussion on 11 Apr, 2018 03:55 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM