Jump to content

Ultimas de tu Fotolog


Recommended Posts

  • 2 weeks later...
  • 6 months later...
  • 3 months later...
  • 3 months later...

hola bueno al parecer ese script ya no funciona o no tanto

bueno quiero compartir lo que hice en un rato de ocio y la cosa sirve para lo mismo que el script originalmente publicado

bueno aqui va:

<?php 
//Rodrigo Castro (cc) 2008
//http://creativecommons.org/licenses/by-sa/2.0/cl/ - Creative Commons Atribución-Licenciar Igual 2.0 Chile License

// Carga del feed del fotolog
$flog = "http://www.fotolog.com/".$_GET['flog']."/feed/main/rss20";
$rss =  simplexml_load_file($flog);
if($_GET['or']=="h"){
foreach ($rss->channel->item as $item) {
  $descr = $item->description;
  $info = explode("<a", $descr);
  $foto = explode("</a>", $info[1]);
  echo "<a".$foto[0]."</a>";
}
} elseif($_GET['or']=="v"){
foreach ($rss->channel->item as $item) {
  $descr = $item->description;
  $info = explode("<a", $descr);
  $foto = explode("</a>", $info[1]);
  echo "<a".$foto[0]."<br /></a>";
}
} else {
foreach ($rss->channel->item as $item) {
  $descr = $item->description;
  $info = explode("<a", $descr);
  $foto = explode("</a>", $info[1]);
  echo "<a".$foto[0]."</a>";
}
}
?>

y para usarlo va haci:

/?flog=TU_FOTOLOG&∨=v (vertical) o

/?flog=TU_FOTOLOG&∨=h (horizontal) o

/?flog=TU_FOTOLOG (por defecto es horizontal)

Edited by r_kstro
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

 <?
if(isset($_POST['agregar']))
{
    $nick_fotolog=$_POST[nick_fotolog];
    $cantidad_imgs_fotolog=$_POST[cantidad_imgs_fotolog];
    $flog="http://www.fotolog.com/".$nick_fotolog;
    roba_pic_flog($flog,$cantidad_imgs_fotolog);
}
function roba_pic_flog($url_flog,$cantidad_imgs_fotolog)
{
    $gestor = fopen ("$url_flog","r");
    
    $flag_inicio="0";
    $tag_inicio="<!-- BEGIN LEFT COL -->";
    $tag_fin="<!-- END LEFT COL -->";
    $ahref="<a href";
    $img="<img";
    $i=0;
    while (!feof($gestor)) 
    {
        $bufer = fgets($gestor, 4096);
        
        if($flag_inicio==="0")    
        $inicio = strstr($bufer,$tag_inicio);
        if($inicio)
        {
            $flag_inicio="1";
        }
        if($flag_inicio==="1")
        {
            $bufer2 = strstr($bufer,$ahref);
            $imagen = strstr($bufer2,$img);
            if($imagen)
            {
                if($i < $cantidad_imgs_fotolog)
                {
                    echo $bufer2;
                    $i++;    
                }
                else
                {
                    break;    
                }
            }
            $fin = strstr($bufer,$tag_fin);
            if($fin)
            {
                break;
            }
        }
    }
    fclose($gestor);
}
?>
    <form action="<?php echo $_SERVER[PHP_SELF] ?>" method="post">
    <table>
    <tr>
        <td>usuario de fotolog</td>
        <td><input type="text" name="nick_fotolog" value="<?php echo $nick_fotolog; ?>"></td>
    </tr>
    <tr>
        <td>cantidad imagenes</td>
        <td><SELECT NAME="cantidad_imgs_fotolog">
           <OPTION VALUE="1">1</OPTION>
           <OPTION VALUE="2">2</OPTION>
           <OPTION VALUE="3">3</OPTION>
           <OPTION VALUE="4">4</OPTION>
           <OPTION VALUE="5">5</OPTION>
           <OPTION VALUE="6">6</OPTION>
        </SELECT></td>
    </tr>
    <tr>
        <td colspan="2"><input type="submit" name="agregar" value="agregar"><td>
    </tr>
</table>
</form>

 

con este codigo puedes mostrar la cantidad de imagenes que desees, si solo kieres mostrar una imagen este te sirve

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...