Now you can put the occasional joke on your own site! You may use the following PHP code on your site to display the latest occasional joke. Your site will update, whenever ours does.

NEW! We’ve built a WordPress plugin that will allow you to show daily jokes on your WordPress blog. Check it out!

Be aware, we claim no responsibility for this code, it’s implementation or effects present or future on your website. In other words, if your site gets screwed up by using this code, don’t come running to us. On a lighter note, it *shouldn’t* screw anything up if you install it right. The basics of the code was taken directly from the PHP website.

<?php
$fp = @fsockopen("jokes.jamesandcarolanne.com", 80, $errno, $errstr, 5);
if (!$fp) {
echo "";
} else {
$out = "GET /latest_joke.php HTTP/1.0\r\n";
$out .= "Host: jokes.jamesandcarolanne.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$res = "";
while (!feof($fp)) {
$res .= fgets($fp, 1024);
}
fclose($fp);
if(@eregi("\r\n\r\n(.+)", $res, $regs))
echo $regs[1];
}
?>

Using this code on your your site will load the the information from this page, onto wherever you put it on your site. You can format it either with CSS or by putting it in a table.

Related Reading: