Title: API Response Headers
Last modified: September 1, 2016

---

# API Response Headers

 *  [memerance](https://wordpress.org/support/users/memerance/)
 * (@memerance)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/api-response-headers/)
 * I am putting a request that pulls a list of orders via the API in PHP.
    I am 
   having a lot of difficulty in accessing the X-WP-TotalPages in the header. Is
   there anyone who can point me in the right direction! Thanks
 * Here is the code I am using at the moment;
 *     ```
       require($_SERVER["DOCUMENT_ROOT"] . "/vendor/autoload.php");
   
       use Automattic\WooCommerce\Client;
   
       $woocommerce = new Client(
           'http://example.com',
           '*****************************',
           '*****************************',
           [
               'wp_api' => true,
               'version' => 'wc/v1',
           ]
       );
       $endpoint = 'orders';
       $options = ['filter[limit]' => '200', 'filter[period]' => 'year', 'filter[order]' => 'ASC', 'status' => 'processing'];
   
       $result = $woocommerce->get($endpoint, $options);
       ```
   
 * I need something like this;
 * `print_r(get_headers($result));`
    Bu that is just not working or any number of
   variations I have tried!
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Caleb Burks](https://wordpress.org/support/users/icaleb/)
 * (@icaleb)
 * Automattic Happiness Engineer
 * [9 years, 9 months ago](https://wordpress.org/support/topic/api-response-headers/#post-7703654)
 * There are some pretty good docs for the wc api here: [http://woothemes.github.io/woocommerce-rest-api-docs/](http://woothemes.github.io/woocommerce-rest-api-docs/)
 * I can’t help much beyond that, as this is pretty custom. You may need to hire
   another dev for further help:
 * – [http://jobs.wordpress.net/](http://jobs.wordpress.net/)
    – [https://codeable.io/](https://codeable.io/)–
   [https://woocommerce.com/experts/?project-scope%5B0%5D=1819](https://woocommerce.com/experts/?project-scope%5B0%5D=1819)
 *  Thread Starter [memerance](https://wordpress.org/support/users/memerance/)
 * (@memerance)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/api-response-headers/#post-7703666)
 * Hey Caleb,
    Thanks for the response, unfortunately no part of any version of 
   the Woo API does it cover the headers and how to access them, well apart from
   the obvious X-WP-TotalPages. I have found a work around for now using a bit of
   jquery to paginate the pages and a bit of clever maths in PHP to make it work
   together.
 * If someone does come across a solution for accessing response headers via the
   API I would really appreciate it.
 * To give some context, I have built an Admin Site for collecting and combining
   data, orders to be processed, sales reports and other useful bits from multiple
   Woocommerce stores into one easy to use platform.
 * The pagination was a bit slow so I wanted to cut out some of the math and extra
   code… Anyway…
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘API Response Headers’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [headers](https://wordpress.org/support/topic-tag/headers/)

 * 2 replies
 * 2 participants
 * Last reply from: [memerance](https://wordpress.org/support/users/memerance/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/api-response-headers/#post-7703666)
 * Status: not resolved