I have a page with urls with descriptions listed one under another (something like bookmarks/list of sites). How do I use php to get all urls from that page and write them t
Another way
$url = "http://wwww.somewhere.com";
$html = file_get_contents($url);
$doc = new DOMDocument();
$doc->loadHTML($html); //helps if html is well formed and has proper use of html entities!
$xpath = new DOMXpath($doc);
$nodes = $xpath->query('//a');
foreach($nodes as $node) {
var_dump($node->getAttribute('href'));
}