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!
I have a file with alot of text and I want to take out all strings starting with "http://" and store those strings in another file. I've been trying to figure out how to do this and I've been messing around with explode(), but with no success so far.
Basically:
Open file.
Read content.
Gather all links
Store them in new file.
Do anyone know how?
Last edited by Lethality on Wed May 02, 2007 4:15 am, edited 1 time in total.
Well, thanks its a nice tool. Though I'd appreciate it if anyone could post the right one. I've been looking (probably not hard enough), but I cannot find the one for urls.
Well, it's good practice for learning regex. Think about it. What do all urls have in common?
They don't ALWAYS have http://, so that should be optional (but if it isn't there, maybe you should add it). They have more than one name with a period, and end in com, net, org, info, edu, etc. They CAN have a slash, but if they have anything after the .com (or whatever), a slash has to be there first.
This will print and write only one of the urls in the array. Is there a way to get the max size of the array and make it print out all the links that exists in the file?
So far it only gets one link.
Tab control is not within PHP's domain of influence. The only thing you can use is asking the browser to open a new window (which is not a standards complaint request now.)