This is my SOAP client code:

$client = new SoapClient('mybaseurl/api/v2_soap?wsdl=1');
$session = $client->login('myuser','mypass');
$filter = array('filter' => array(array('key' => 'status', 'value' => 'processing')));
$results = $client->salesOrderList($session, $filter);

This returns me a list of orders with the processing status. But I want to get all of the orders made from the last 24 hours or 48 hours . How can i filter this ?

I tried smth like this:

$fromDate = date('Y-m-d H:i:s', strtotime('-1 days'));
$todayDate = date('Y-m-d H:i:s');
$filter = array('filter' => array(array('key' => 'created_tat', 'value' => array('from'=>$fromDate, 'to'=>$todayDate))));

But i got this message: Array to string conversion. Any idea ?

1 Answer 1


You need to convert $fromdate and $todayDate variable format, that fetch record from order table.

$fromDate = date('Y-m-d'. ' 00:00:00', strtotime('-1 days'));
$todayDate = date('Y-m-d'. ' 00:00:00');

Then try in this way,

$filter = array('complex_filter'=>  array('key'=>'created_at','value'=>array('key' =>'gteq','value' => $fromDate)),
                            array('key'=>'created_at','value'=>array('key' =>'lteq','value' => $todayDate)),);

$results = $client->salesOrderList((object)array('sessionId' => $session, 'filters' => $filter));   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.