Code Executing Slowly


I have written some code that returns job search results based on some criteria:
Here is the link:

I copy the job results into an array and then parse out using a pagination routine.

This code is executing so slow as you will see it running at the above link.

Thank you.

Use xDebug to profile your code:

You definitely have some inefficiencies. First of all, you are retrieving the job listing for page 1 to get the total number of pages, and then requesting page 1 again in your loop (just load page 1 based on your total number of pages logic, and skip page 1 in the loop).

Second, you are looping through all of the pages on each page load… Why? Just load the single page you need. You are effectively calling 11 times to load 10 results.

Instead, you should call 1 time, passing the page you want to load, use the totalresults node to build the navigation/paging, and loop through $rss->channel->item to load the results.