Because PHP doesn't have multithreading capabilities I am trying to find a workaround to speed up a simple process.
The process is I am posting data to a webpage with various permutations in the post-data on each request. In a foreach
loop I am checking each request response to see if a string exists using strspos
. When it is found, it break
s and returns the page. There are around 1000 requests, and it takes bout 1 minute to complete or longer.
As I don't want to use additional libraries, my idea was to exec standalone scripts passing each permutation of post data (say 1000 processes). Each process will only write to a file if the string is found. And on the main script I will run a loop checking if file exists, when it does find that the file exists, can read the file for the post data that was correct.
It seems sound in theory, but I wanted to check if this is a ridiculous solution for a problem that has much simpler solutions!
Thanks.