Scummy12 Posted February 16, 2011 Share Posted February 16, 2011 I am running a script to retrieve numerical value from a webpage, the script echoes the numbers. However I need to add all the numbers to an array or txt file and then have them sorted from highest value to lowest value. Any hints or tips to how I would achieve this? Quote Link to comment Share on other sites More sharing options...
silkfire Posted February 16, 2011 Share Posted February 16, 2011 Use a preg match all then sort() the array you receive. Very simple. Quote Link to comment Share on other sites More sharing options...
Scummy12 Posted February 16, 2011 Author Share Posted February 16, 2011 Use a preg match all then sort() the array you receive. Very simple. Sounds easy, however the script loops indefinitely. It only gathers 1 number (because it visits multiple webpages for its data) per loop and echo's the value. How can I write all the values it echo's into an array? Quote Link to comment Share on other sites More sharing options...
silkfire Posted February 16, 2011 Share Posted February 16, 2011 If it loops indefinitely then there's a flaw in your script. What do you want to achieve and why doesn't your script have a stop condition? Quote Link to comment Share on other sites More sharing options...
Scummy12 Posted February 16, 2011 Author Share Posted February 16, 2011 If it loops indefinitely then there's a flaw in your script. What do you want to achieve and why doesn't your script have a stop condition? The script is meant to loop indefinitely as there is always an ever changing amount of pages to visit. However I have solved my problem, thanks everyone for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.