I have a text file which contains many (over 5000) links. Like this:
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
http://www.website.com/rgfdefvrggh
etc etc....
I'm trying to fetch each link at a time and do stuff with it....
so one by one, get the link do something and then move on to the next....
I don't know how i would split the links up...
they're all in a .txt file, separated by a line break.
any ideas?
Use the file function to read your file in an array, one element per line. For example:
$links = file('data.txt');
foreach($link in $links) {
// do something with $link
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With