Skip to main content
Published: June 22 2011, 2:21:00 PMUpdated: November 28 2020, 9:50:23 PM

Here is a code sample for GetOrders API Call in PHP.

Please Find the Attachment GetOrders.Zip. You need to have Curl for PHP installed to use this code sample.

How to configure?

Extract the files, and open keys.php file in get-common directory.

If you want to use this sample in production, then set $production = true; , if you wnat to test in sandbox, set $production = false;

fill the required

       $compatabilityLevel = 717;    // eBay API version

       $devID = 'xxxxxxxx';  

        $appID = 'xxxxxxxxx';
        $certID = 'xxxxxxxxxxxxxx';      

        //set the Server to use (Sandbox or Production)
        $serverUrl = '';      // server URL different for prod and sandbox
        //the token representing the eBay user to assign the call with
        $userToken = '*************';          

// for production and/or sandbox.

now goto the url http:://path/to/GetOrders/GetOrders.php , you should see the parsed values printed.

If you want to see how the response XML looks like, then goto url

http:://path/to/GetOrders/GetOrders.php?debug=1 : this prints the response XML.


Open up the GetOrders.php file, and you should be able to configure CreateTimeFrom and CreateTimeTo

//by default this code sample  retreives orders in last 30 minutes //Time with respect to GMT

$CreateTimeFrom = gmdate("Y-m-d\Th:i:s",time()-1800); //current time minus 30 minutes
$CreateTimeTo = gmdate("Y-m-d\Th:i:s");

Additionally you can change the CreateTimeFrom and CreateTimeTo values
//If you want to hard code From and To timings, Follow the below format in "GMT".
//$CreateTimeFrom = YYYY-MM-DDTHH:MM:SS; //GMT
//$CreateTimeTo = YYYY-MM-DDTHH:MM:SS; //GMT

More Information on GetOrders Request :






How well did this answer your question?