; break; } $i++; $node = $node->next_sibling(); } return $res; }
$res = xml_to_result($dom);
// Ok, now that we have the results in an easy to use format, // display them. It's quite ugly because I am using a single // display loop to display every type and I don't really understand HTML $first = $res['firstResultPosition']; $last = $first + $res['totalResultsReturned']-1; echo "<p>Matched ${res[totalResultsAvailable]}, showing $first to $last</p>\n"; if(!empty($res['ResultSetMapUrl'])) { echo "<p>Result Set Map: <a href=\"${res[ResultSetMapUrl]}\">${res[ResultSetMapUrl]}</a></p>\n"; } for($i=0; $i<$res['totalResultsReturned']; $i++) { foreach($res[$i] as $key=>$value) { switch($key) { case 'Thumbnail': echo "<img src=\"${value[Url]}\" height=\"${value[Height]}\" width=\"${value[Width]}\" />\n"; break; case 'Cache': echo "Cache: <a href=\"${value[Url]}\">${value[Url]}</a> [${value[Size]}]<br />\n"; break; case 'PublishDate': echo "<b>$key:</b> ".strftime('%X %x',$value); break; default: if(stristr($key,'url')) echo "<a href= 上一页 [1] [2] [3] [4] [5] [6] 下一页 |