I'm trying to write a script that grabs and filters integers from pages under a different domain. It looks like this:
1: $value = file_get_contents("http://sample.url.com");
2: $begin_pos = strpos($value,"<b>Current Value:</b>");
3: $raw_val = substr($value,$begin_pos,30);
4: $clean_val = filter_var($raw_val, FILTER_SANITIZE_NUMBER_INT);
Which should be easy to interpret.
1: Reads the source of the target page into a string.
2: Searches for a string within the source that will indicate where the integer is.
3: Goes to that spot in the source and returns the next 30 characters which should contain the integer.
4: Filters the 30 characters for the integer alone.
The script works as it should, but it's too slow. On top of this, my entire script is written to output around 150 integers the same way. It takes 6-8 minutes to finish.
Is there faster way to do this, even if it involves another language? Thanks for reading.