<?php
ob_start
("ob_gzhandler");
error_reporting(E_NONE);
@include_once(
$_SERVER["DOCUMENT_ROOT"]."/shortstat/inc.stats.php");
$url 'http://charges.uol.com.br/arquivo.html';
require(
$_SERVER['DOCUMENT_ROOT'].'/inc/curl.php');
$content open_url($url);
$hash md5($content);
$headers getallheaders();
if (
ereg($hash$headers["If-None-Match"])){
    
header("HTTP/1.1 304 Not Modified");
    
ob_end_clean();
    exit();
}
$content iconv('iso-8859-1''utf-8'$content);
preg_match_all("/<a href=\"vercharge.php\?idcharge=(\d+)&amp;modo=som\"><img src=\"images\/charges\/(\d+)\.gif\" alt=\"\" \/><\/a>/"$content$links); // idcharge = $links[1], idimg = $links[2]
preg_match_all("/<li class=\"chargetit\">([^<]+)<\/li>/"$content$titles); //titulo = $titles[1]
preg_match_all("/<li class=\"data\">(\d\d)\/(\d\d)\/(\d\d\d\d)) - <\/li>/"$content$dates); //date = $dates[1]
header("Content-type:application/xml; charset=utf-8");
print 
'<?xml version="1.0" encoding="UTF-8" ?>';
$datefeed date("Y-m-d\Th:i:s"strtotime($dates[3][0] . "-" $dates[2][0] . "-" $dates[1][0])) . "-03:00";
?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <title>Charges.com.br | Maurício Ricardo</title>
    <link rel="alternate" type="text/html" href="http://charges.uol.com.br/arquivo.html"/>
    <modified><?php print $datefeed ?></modified>
    <author>
        <name>Maurício Ricardo</name>
    </author>
    <tagline>Arquivo de Charges do charges.com.br</tagline>
  <?php for($i=0$i<sizeof($links[1]); $i++): ?>
<?php 
  $date 
date("Y-m-d\Th:i:s"strtotime($dates[3][$i] . "-" $dates[2][$i] . "-" $dates[1][$i])) . "-03:00";
  
$id "tag:charges.uol.com.br," date("Y-m-d"strtotime($date)) . ":/" time()*($i+1);
?>
  <entry>
    <title><?php print $titles[1][$i?></title>
    <link rel="alternate" type="text/html" href="http://charges.uol.com.br/vercharge.php?idcharge=<?php print $links[1][$i?>&amp;modo=som"/>
    <id><?php print $id ?></id>
        <created><?php print $date ?></created>
        <issued><?php print $date ?></issued>
        <modified><?php print $date ?></modified>
        <content type="text/html" mode="escaped" xml:lang="pt-BR" xml:base="http://charges.uol.com.br/arquivo.html">
        <![CDATA[<p>
      <a href="http://charges.uol.com.br/vercharge.php?idcharge=<?php print $links[1][$i?>&amp;modo=som"><img src="http://charges.uol.com.br/images/charges/<?php print $links[2][$i?>.gif" alt="<?php print $titles[1][$i?>" /></a></p>
      <p><a href="http://charges.uol.com.br/vercharge.php?idcharge=<?php print $links[1][$i?>&amp;modo=som">Versão com som</a></p>
      <p><a href="http://charges.uol.com.br/vercharge.php?idcharge=<?php print $links[1][$i?>&amp;modo=baloes">Versão com legendas</a></p>
      <?php if ($i == 0): ?>
      <p>
       <a href="http://www.submarino.com.br/books.asp?Query=ProductPage&ProdTypeId=1&franq=141642">
       <img src="http://afiliados.submarino.com.br/afiliados/banner/categoria_full_livros.gif" width="468" height="60" border="0"></a>
      </p>
      <?php endif; ?>
      ]]>
        </content>
        <author>
            <name>Maurício Ricardo</name>
        </author>
        <dc:subject>Charges</dc:subject>
  </entry>
<?php endfor; ?>
</feed>
<?php
header
("ETag: \"$hash\"");
ob_end_flush();
?>