PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Are you trying to match whole domains, domains that begin with certain keywords, or domains that contain certain keywords anywhere? The first two would be relatively easy to implement with very little memory if your keywords are sorted. Depending on the size of your keyword list, the third may require a little more creativity since the domain list contains hundreds of thousands of domains.
The text file is 12 times bigger than the Zip archive. Whatever time you spend writing code to uncompress the file on the server will surely be earned back over the lifetime of the script.
I'm still not sure how many keywords you want to match. If it's not too many, you can put them all in an array (hint: file() -- be sure to ignore newlines) to be compared to each line in the domain list file. But remember, in the worst-case scenario, each of the keywords will be compared to each of the domains. If there are 20 keywords and 350 thousand domains, that is seven million comparisons. The script could take a while.
You will need to create a file resource with fopen() for reading the domain list file. (Don't try to put all the lines in an array. That would hog too much memory.) Write a loop that reads a line from the file. Shorten the line so only the domain part remains (hint: strstr() -- every domain in the file is followed by a space character). Search the domain for each of the keywords (hint: strpos()). If you find one keyword in the domain, you don't need to search for the other keywords. Finally, close the file.