Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/02/2009, 08:20
diego007007
 
Fecha de Ingreso: enero-2009
Ubicación: en la casa
Mensajes: 223
Antigüedad: 15 años, 3 meses
Puntos: 3
ingresar datos a MySQL

Hola amigos, tengo el siguiente codigo
Código PHP:
function Obtener_contenidos($url,$inicio='',$final){
$source = @file_get_contents($url)or die('se ha producido un error');
$posicion_inicio strpos($source$inicio) + strlen($inicio);
$posicion_final strpos($source$final) - $posicion_inicio;
$found_text substr($source$posicion_inicio$posicion_final);
return 
$inicio $found_text .$final;
}
$url 'http://www.threatexpert.com/reports.aspx'/// pagina web del contenido
$swear = array("report.aspx?md5=");
$textObtener_contenidos($url,'<span id="txtResults">','<table align="center" cellspacing="0">');;
foreach(
$swear as $key=> $value){
$text str_replace("$value"" "$text);
}
$link mysql_connect("localhost""root""");
mysql_select_db($dbname$link);

$regExp1="/href=\"(.*?)\"/is" ;
$regExp2="/<a.*?>(.*?)<\/a>/is";
$file = ('$text');
preg_match_all($regExp1,$text,$a);
$count count($a[1]);
echo 
"<b>Dierecciones primera pagina</b> = " .$count."<p>";
for (
$row 0$row $count $row++) {

$dato $a[1]["$row"];
$query "INSERT INTO md5 (numero) VALUES ('".$dato."')";
mysql_query($query);

}

mysql_close($link); 
y my base de datos es la siguiente

Cita:

-- Database: `virusdb`
--

-- --------------------------------------------------------

--
-- Table structure for table `md5`
--

CREATE TABLE `md5` (
`numero` varchar(40) default NULL,
UNIQUE KEY `numero` (`numero`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
pero no se ingresa ningun dato, alguien puede ayudarme