Trying to find a way to reorder the result from an HTTP API. Here is an example
https://demo.piwik.org/?module=API&method=VisitsSummary.get&idSite=7&period=month&date=last3&format=xml&token_auth=anonymous
which returns
<results>
<result date="2017-10"/>
<result date="2017-11"/>
<result date="2017-12"/>
</results>
Yet, I want to it returned as
<results>
<result date="2017-12"/>
<result date="2017-11"/>
<result date="2017-10"/>
</results>
I have tried using filter_sort_order
in the URL but this didn't work. Is there a way to do this within the URL or a solution in PHP
that can do this post getting the XML
?
Continued from the comments:
Sorry, but if the API doenot provide an option, then you have to acecpt what it sends.
If you want the results to be sorted, then you can either sort them client side in JavaScript, or fetch the data from your own server side PHP, sort them, and provide that as a an API to the client side.
If you want several different types of sorting, then I would suggest the latter.