Retrieving XML Data using PHP


I have a PHP script that is using the eBay API. It makes the call and then returns XML data which then is retrieved using foreach in PHP.

However, I want it to select a random result and print this eBay listing. Do i do this with an array?

Because when I limit the returned results to one, it gives me the same result each time. It doesn’t randomly select one eBay listing. So, I thought I could return 50 results and then randomly choose one.

Could someone help me do this?

Thanks and hopefully i explained everything, just ask if I am missing something!