$value) $trans[$key] = '&#'.ord($key).';'; // dont translate the '&' in case it is part of &xxx; $trans[chr(38)] = '&'; } // after the initial translation, _do_ map standalone '&' into '&' return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($string, $trans)); } if (empty($hyvesname)) { $hyvesname = $_GET['h']; } if (empty($hyvesname)) { ?> Hyves naar RSS Converter

Hyves RSS

Hyves Blog 2 RSS Converter.

Door cogmios en Michel.

Hyves Naam:

Deze service levert je een RSS feed van iemand's weblog op Hyves.

Vul het vakje in, druk op submit en je kunt de gegenereerde url in je eigen programmaatjes stoppen.

Opmerkingen, vragen e.d. kunnen via ... mijn Hyves page of die van Cogmios. (waar anders).

Versie (broncode)

(time()-($cachemin*60))) { $file_contents = file_get_contents($cache); } else { touch($cache); $ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $fullblog); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_CRLF, 0); $file_contents = curl_exec($ch); curl_close($ch); $handle = fopen($cache,"w"); fwrite($handle,$file_contents); fclose($handle); } // $file_contents = utf8_encode(file_get_contents($fullblog)); // $file_contents = utf8_encode($file_contents); // $file_contents = iconv("UTF-8","UTF-8",file_get_contents($fullblog)); // $file_contents = file_get_contents($fullblog); $enc = mb_detect_encoding($file_contents); // if (empty($enc)) $enc="ISO-8859-1"; if (empty($enc)) $enc="CP1252"; // $file_contents = iconv($enc,"UTF-8",$file_contents); // $file_contents = utf8_encode($file_contents); // $enc="UTF-8"; $file_contents = stripslashes(str_replace("\\r","",str_replace("\\n","",$file_contents))); if (preg_match_all('|class="singlecontent_block">(.*?)|is', $file_contents, $matches)) { unset($matches[0]); if ($show!="source") { header ("Content-Type: text/xml; charset=" . $enc); printf(""."\n"); printf(""."\n"); } else { header("Content-Type: text/plain"); }; printf("\n"); printf("Hyves weblog ".$blogname."\n"); printf("http://" . $blogname . ".hyves.nl/blog/\n"); printf("Hyves Blog van " . $blogname. "\n"); printf("hyves2rss " . $version . " (http://hyvesblog2rss.klijmij.net/)\n"); foreach ($matches as $post2) { $p=0; foreach ($post2 as $post) { $p++; if ($p>10) break; if ($show=="tags" && $p>5) break; printf("\n"); // ======================= // get the titlepart (containing title and permalink) // ======================= preg_match('|personal_header BlogTitle">(.*?)|is', $post, $post_titlepart); $post_titlepart = trim($post_titlepart[1]); // ======================= // get the title // ======================= preg_match('|personal_link personal_header">(.*?)|is', $post_titlepart, $post_title); $post_title = xmlentities(strip_tags(trim($post_title[1]))); printf("".$post_title."\n"); // ======================= // get the permalink // ======================= preg_match('|"); echo $post_permalink; printf("\n"); // ======================= // get the date // ======================= preg_match('|style="display: block;padding-top: 3px;">(.*?)|is', $post, $post_date); $post_date = trim($post_date[1]); // Problem: strtotime doesn't understand dates like // 25 Sep 16:48 because there's no year. if (!ereg(date("Y")."|".date("Y")-1,$post_date) && preg_match("/^[0-9]/",$post_date)) $post_date = str_replace(","," ".date("Y"),$post_date); $post_date = ereg_replace("vandaag|today",date("Y-m-d"),$post_date); $post_date = str_replace(",", "", $post_date); $post_date = strtotime($post_date); // New Year's Bug if ($post_date>(time()+(7*86400))) $post_date = $post_date - (365*86400); // Problem: Hyves reports dates as day, which are sometimes // converted to the future, and sometimes to the past. If the // date is in the future, substract a week. if ($post_date>(time()+43200)) $post_date = $post_date - (7*86400); $post_date = date("r", $post_date); printf("".$post_date."\n"); // ======================= // get the content // ======================= preg_match('|singlecontent_block personal_text">(.*?)\n
|is', $post, $post_content); $post_content = trim($post_content[1]); printf("\n"); printf(""); echo "" . $post_content . "

\n"; printf("]]>
\n"); if ($show=="tags") { $cache = "cache/" . $blogname . "-" . md5($post_title) . ".html"; if (file_exists($cache) && filemtime($cache) > (time()-($cachemin*60))) { $blogpost = file_get_contents($cache); } else { touch($cache); $blogpost = file_get_contents($post_permalink); $handle = fopen($cache,"w"); fwrite($handle,$blogpost); fclose($handle); } if (preg_match_all('|
(.*?)|is', $blogpost, $blogtags)) { foreach ($blogtags as $tags) { foreach ($tags as $taglink) { preg_match('|(.*?)|is',$taglink,$tag); $tag = trim($tag[1]); if (empty($tag)) continue; printf("" . xmlentities($tag) . "\n"); } } } } printf("\n"); } // foreach $post } // foreach $matches printf("\n"); printf("\n"); } else { // header("location: http://www.hyves.nl/rss/blogs/?hyverusername=" . $blogname); // exit; echo "

Sorry, Hyves could not be reached or the name (" . $blogname . ") you supplied does not exist, or error parsing the html shown below!

"; echo ""; echo "
" . htmlspecialchars($file_contents) . "
"; /* header ("Content-Type: text/xml"); printf(""."\n"); printf(""."\n"); printf("\n"); printf("Hyves weblog ".$blogname."\n"); printf("http://" . $blogname . ".hyves.nl/blog/\n"); printf("Hyves Blog van " . $blogname . " - converted by www.cogmios.nl - alfa 0.1 still working on it!!\n"); printf("Sorry, Hyves could not be reached or the name you supplied does not exist!\n"); printf("\n"); printf("\n"); */ } } ?>