How do I extract info from a block of URLs in php?

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-05-10T18:37:46Z Indexed on 2010/05/10 18:44 UTC
Read the original article Hit count: 165

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about preg-match