How do I extract info from a block of URLs in php?
- by Jack
I have a list of urls, which can come in any format. One per line, separated by commas, have random text in between them, etc. the URLs are all from 2 different sites, and have a similar structure
For this example, lets say it looks like this
Random Text - http://www.domain2.com/variable-value
Random Text 2 - http://www.domain1.com/variable-value, http://www.domain1.com/variable-value, http://www.domain1.com/variable-value
http://www.domain1.com/variable-value
http://www.domain2.com/variable-value
http://www.domain1.com/variable-value http://www.domain2.com/variable-value http://www.domain1.com/variable-value
I need to extract 2 pieces of information. Check to see if its domain1 or domain2 and the value that follows "variable-"
So it should create a multi-dimensional array, which would have 2 items: domain + value.
Whats the best way of doing that?