Ver Mensaje Individual
  #13 (permalink)  
Antiguo 12/08/2010, 15:26
Avatar de prodan
prodan
 
Fecha de Ingreso: junio-2008
Mensajes: 85
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Verficar un tag html, con php

Gracias Marvin, te explico aver si me entendes.. la variable flash despues la tengo que mandar a otra pagina por post, entonces tengo que hacer un input hidden con el valor de esa variable (Si o No) afuera de la funcion, use el codigo que me mandastes pero no pude hacer que funcione. te muestro el codigo que tengo aver si me podes ayudar.

Código PHP:
Ver original
  1. if (isset($_GET['estado'])) {
  2.                 $estado = $_GET['estado'];
  3.                 if($estado=="verificaenlace") {
  4.                 ?>
  5.                 <form action="<? $_SERVER['PHP_SELF'] ?>" method="post">
  6.                     <font style="text-decoration:underline;">Seleccione URL:</font>
  7.                     <select name="url">
  8.                         <?
  9.                         $sql = mysql_query("SELECT urlenlace FROM paginaspw3");
  10.                         while($row=mysql_fetch_array($sql)) {
  11.                             echo"
  12.                             <option>".$row['urlenlace']."</option>";
  13.                         }
  14.                         ?>
  15.                         </select>
  16.                         <input type="submit" value="Verificar" name="verifica" />
  17.                 </form>
  18.                 <?
  19.                }
  20.                
  21.                    if($estado=="verificahome") {
  22.                         ?>
  23.                         <form action="<? $_SERVER['PHP_SELF'] ?>" method="post">
  24.                             <font style="text-decoration:underline;">Seleccione URL:</font>
  25.                             <select name="url_home">
  26.                             <?
  27.                                 $sql = mysql_query("SELECT webpage FROM paginaspw3");
  28.                                 while($row=mysql_fetch_array($sql)) {
  29.                                     echo"
  30.                                     <option>".$row['webpage']."</option>";
  31.                                 }
  32.                             ?>
  33.                             </select>
  34.                             <input type="submit" value="Verificar Home" name="verifica" />
  35.                         </form>
  36.                         <?
  37.                     if(isset($_POST['url_home'])) {
  38.                             $url_home = $_POST['url_home'];                    
  39.                             $pagina_inicio = file_get_contents($url_home);
  40.        
  41.                             function buscarCadenaFlash($cadena,$palabra){
  42.                                 if (strstr($cadena,$palabra)){
  43.                                     return "<b>Archivos Flash: <font color='green'>Si</b></font>";
  44.                                     $flash = "Si";
  45.    
  46.                                 }else{
  47.                                     return "<b>Archivos Flash: <font color='red'>No</font></b>";
  48.                                     $flash = "No";
  49.                                 }
  50.                                 return $flash;
  51.                             }  
  52.                             $cadena=$pagina_inicio;
  53.                             $palabra=".swf";
  54.                             echo buscarCadenaFlash($cadena,$palabra);
  55.                             echo "<br>";
  56.                             $pagina_inicio = file_get_contents('http://www.vivalinux.com.ar/');
  57.                             function buscarCadenaAlt($cadena,$palabra)
  58.                             {
  59.                                 if (strstr($cadena,$palabra)) {
  60.                                     return "<b>ALT en img src: <font color='green'>Si</font></b>";
  61.                                     return $alt="Si";
  62.                                 }else {
  63.                                     return "<b>ALT en img src: <font color='red'>No</font></b>";
  64.                                     return $alt="No";
  65.                                 }
  66.                             }
  67.                             $cadena=$pagina_inicio;
  68.                             $palabra="alt";
  69.                             echo buscarCadenaAlt($cadena,$palabra);
  70.                             echo "<br>";
  71.                             $pagina_inicio = file_get_contents($url_home);
  72.                             function buscarCadenaGoogle($cadena,$palabra)
  73.                             {
  74.                                 if (strstr($cadena,$palabra)) {
  75.                                     return "<b>Google Analytics: <font color='green'>Si</font></b>";
  76.                                     return $google="Si";
  77.                                 } else {
  78.                                     return "<b>Google Analitycs: <font color='red>'No</font></b>";
  79.                                     return $google="No";
  80.                                 }                  
  81.                             }
  82.                             $cadena=$pagina_inicio;
  83.                             $palabra="google analytics";
  84.                             echo buscarCadenaGoogle($cadena,$palabra);     
  85.                             echo "<br>";                                               
  86.                             $pagina_inicio = file_get_contents($url_home);
  87.                             function buscarCadenaTitle($cadena,$palabra)
  88.                             {
  89.                                 if (strstr($cadena,$palabra)) {
  90.                                     return "<b>Texto entre title: <font color='red'>No</font></b>";
  91.                                     return $title="No";
  92.                                 } else {
  93.                                     return "<b>Texto entre title: <font color='green'>Si</font></b>";
  94.                                     return $title="Si";
  95.                                 }
  96.                             }
  97.                             $cadena=$pagina_inicio;
  98.                             $palabra="title></title";
  99.                             echo buscarCadenaTitle($cadena,$palabra);          
  100.                             echo "<br>";                       
  101.                             $pagina_inicio = file_get_contents($url_home);
  102.                             function buscarCadenaTitlehref($cadena,$palabra)
  103.                             {
  104.                                 if (strstr($cadena,$palabra)) {
  105.                                     return "<b>Tiene title en links: <font color='red'>No</font></b>";
  106.                                     return $titleref="No";
  107.                                 } else {
  108.                                     return "<b>Tiene title en links: <font color='green'>Si</font></b>";   
  109.                                     return $titleref="Si";
  110.                                 }
  111.                             }
  112.                             $cadena=$pagina_inicio;
  113.                             $palabra='<a href= title=""';
  114.                             echo buscarCadenaTitlehref($cadena,$palabra);  
  115.  
  116.                             ?>
  117.                             <form action="<? $_SERVER['PHP_SELF'] ?>" method="POST">
  118.                                 <input type="hidden" value="<? echo $url_home; ?>" name="url_home" />
  119.                                 <input type="hidden" value="<? echo $flash; ?>" name="flash" />
  120.                                 <input type="hidden" value="<? echo $alt; ?>" name="alt" />
  121.                                 <input type="hidden" value="<? echo $google; ?>" name="google" />
  122.                                 <input type="hidden" value="<? echo $title; ?>" name="title" />
  123.                                 <input type="hidden" value="<? echo $titleref; ?>" name="titleref" />
  124.                                 <input type="submit" name="exporta_pdf" value="Exportar a PDF" />
  125.                             </form>
  126.                             <?
  127.                             echo "<br>";       
  128.                             echo $flash;
  129.                                                        
  130.                         }  
  131.                              
  132.                        
  133.                     }  
  134.    
  135.                         if(isset($_POST['exporta_pdf'])) {
  136.                             require_once('includes/libpdf/fpdf.php');
  137.                             require_once('includes/libpdf/fpdi.php');
  138.                             $url = $_POST['url_home'];
  139.                             $flash = $_POST['flash'];
  140.                             $alt = $_POST['alt'];
  141.                             $google = $_POST['google'];
  142.                             $title = $_POST['title'];
  143.                             $titleref = $_POST['titleref'];
  144.  
  145.                             $pdf=new FPDF();
  146.                             $pdf->AddPage();
  147.                             $pdf->Image('img/membrete----posicionamiento-natural.jpg',0,0,210,38);
  148.                             $pdf->SetFont('Arial', 'B', 14);
  149.                             $pdf->SetXY(0,40);
  150.                             $pdf->Write('','Datos del Dominio '.$url,'');
  151.                             $pdf->SetFont('Arial','', 14);
  152.                             $pdf->Line(48,55,48,190);
  153.                             $pdf->SetXY(50,65);
  154.                             $pdf->Write('','Tiene archivos Flash: '.$flash,'');
  155.                             $pdf->Line(0,70,100,70);
  156.                             $pdf->SetXY(50,80);
  157.                             $pdf->Write('','Tiene alt en links: '.$alt,'');
  158.                             $pdf->Line(0,85,110,85);
  159.                             $pdf->SetXY(50,95);
  160.                             $pdf->Write('','Google Analitycs: '.$google,'');
  161.                             $pdf->Line(0,100,110,100);             
  162.                             $pdf->SetXY(50,110);
  163.                             $pdf->Write('','Tiene Title: '.$title,'');
  164.                             $pdf->Line(0,115,110,115);     
  165.                             $pdf->SetXY(50,125);
  166.                             $pdf->Write('','Title en img: '.$titleref,'');
  167.                             $pdf->Line(0,130,110,130);     
  168.                    
  169.                             $pdf->Output('asdasd.pdf', 'F');
  170.                       }
  171.                     }
  172.        
  173.                 ?>

fijate que las variables que uso en las funciones las guardo las mando en el input hidden, la cosa que despues no aparecen en el pdf.

saludos.