hello dear community,
i want to get the results of a simple DOM parser-object - sorted in a better manner - cvs or so
see here the simple DOM program to extract Google result links eg for this URL
<?php
# Use the Curl extension to query Google and get back a page of results
$url = "my google request ";
$ch = curl_init();
$timeout = 5;
# sets the timeout
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$html = curl_exec($ch);
curl_close($ch);
# Create a DOM parser object
$dom = new DOMDocument();
# Parse the HTML from Google.
# The @ before the method call suppresses any warnings that
# loadHTML might throw because of invalid HTML in the page.
@$dom->loadHTML($html);
# Iterate over all the <a> tags
foreach($dom->getElementsByTagName('a') as $link) {
# Show the <a href>
echo $link->getAttribute('href');
echo "<br />";
}
?>
i get a bunch of urls
what i want to achieve that the result is coming in a better overview - eg. as a cvs output or so?