I was recently after a script from a php programmer on here regarding pulling the top 10 searches from technorati and using them in a 'certain way' He said it wasnt possible (not saying hes wrong) but just checking here before I give up on the idea...
http://krakjoe.com/temp/technorati.com.php Near on anything is possible, which certain way would you like to use the data ??
^^ Beat me to it... Anyway, here's my solution. function technorati_search($query, $bucket = 'kwd') { $bucket = strtolower($bucket); if (!in_array($bucket, array('kwd', 'tag', 'blog'))) { $bucket = 'kwd'; } $ch = curl_init('http://technorati.com/search.php'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, 's=' . rawurlencode($query) . '&bucket=' . $bucket); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if (!preg_match_all('/<li\s+class="hentry(\s+first-child)?">(.*?)<\/li>/si', curl_exec($ch), $entries)) { return false; } curl_close($ch); $results = array(); foreach ($entries[2] AS $key => $entry) { preg_match('/<a\s+href="([^"]+)"[^>]+>([^<]+)/i', $entry, $matches); $results[$key]['itemurl'] = $matches[1]; $results[$key]['itemtitle'] = $matches[2]; preg_match('/<cite\s+class="bloginfo"><a\s+href="\/blogs\/([^"]+)[^>]+>([^<]+)/i', $entry, $bloginfo); $results[$key]['blogurl'] = rawurldecode($bloginfo[1]); $results[$key]['blogname'] = $bloginfo[2]; preg_match('/<blockquote\s+class="entry-summary"[^>]+>(.*?)<\/blockquote>/si', $entry, $summary); $results[$key]['summary'] = strip_tags(trim($summary[1])); } return $results; } PHP: Usage example: echo '<pre>'; $results = technorati_search('Company Flow'); if (!$results) { echo 'No results found.'; } else { print_r($results); } PHP:
some overkill there nico <?php function top_ten( ) { $return = null; if(!($read = fopen( 'http://technorati.com/', 'r' ))): die("Cannot open technorati"); return false; else: preg_match('#<ol>(.*?[^ol>])</ol>#si', file_get_contents( 'http://technorati.com/' ), $top ); $data = split( '</li>', $top[1] ); if( $data ) { $result = array( ); $count = 0 ; foreach( $data as $value ) { if( trim( $value ) != "" ) { preg_match( '#<a href="(/search/.*?[^ ])" .*?>(.*?[^<])</a>#si', $value, $match ); $result[$count + 1]["title"] = trim( $match[2] ); $result[$count + 1]["url"] = trim( $match[1] ); $count++; } } return $result; } endif; } ?> <h1>Technorati top ten - not sure why</h1> <?php foreach( top_ten( ) as $pos => $data ) { ?> <?php echo $pos ?> - <a href="http://technorati.com<?php echo $data['url'] ?>"><?php echo $data['title'] ?></a><br /> <?php } ?> PHP: