Despues de la respuesta de patriciomase, he escrito otro código:
Código PHP:
Ver original<?php
require("phpsqlsearch_dbinfo.php");
if (!$connection) {
}
// Set the active mySQL database
if (!$db_selected) {
}
$extrae = $_POST['url'];
$provincias = $_POST['county'];
$paises = $_POST['country'];
// Use internal libxml errors -- turn on in production, off for debugging
// Createa a new DomDocument object
$dom = new DomDocument;
// Load the HTML
$dom->loadHTMLFile($extrae);
// Create a new XPath object
$xpath = new DomXPath($dom);
//Query all <td> nodes containing specified class name
$titulos = $xpath->query('//a[@class="url"]|//p[@class="tel"]|//span[@class="street-address"]|//a[@class="locality"]|//span[@class="latitude hidden"]|//span[@class="longitude hidden"]');
// Set HTTP response header to text/html for debugging output
header('Content-type: text/html; charset=utf-8'); foreach($titulos as $titulo) {
$datos = $titulo->nodeValue;
}
?>
Este codigo me devuelve:
string(35) "
G. Elias y Muñoz Abogados"
string(16) "+34 915 71 17 87"
string(37) "C/ Sor Ángela de la Cruz, 24 - 3º D"
string(6) "Madrid"
string(10) "40.4598677"
string(10) "-3.6957341"
string(58) "
San Martín Rodriguez Abogados - Bufete Casadeley"
string(16) "+34 914 41 46 59"
string(25) "Calle de José Abascal 58"
string(6) "Madrid"
string(10) "40.4378855"
string(10) "-3.6914792"
string(25) "
Abanlex Abogados"
string(16) "+34 915 64 93 45"
string(53) "Calle de Velázquez 109, 7º Izquierda - Madrid 28006"
string(6) "Madrid"
string(16) "40.4362994223884"
string(16) "-3.6834454536438"
string(29) "
Accidente y Tráfico"
string(16) "+34 913 23 99 41"
string(37) "Calle Nuñez Morgado 6, 28036, Madrid"
string(6) "Madrid"
string(10) "40.4686546"
string(10) "-3.6853908"
string(32) "
EL Monasterio del Cobro"
string(16) "+34 915 56 32 11"
string(30) "PASEO DE LA CASTELLANA, 129, 1"
string(6) "Madrid"
string(10) "40.4585177"
string(10) "-3.6905893"
string(23) "
Manga Abogados"
string(16) "+34 915 55 75 86"
string(24) "Calle de Orense 39, 3ºb"
string(6) "Madrid"
string(9) "40.453842"
string(9) "-3.694883"
string(27) "
Garrigues Abogados"
string(13) "Hermosilla, 3"
string(6) "Madrid"
string(10) "40.4266467"
string(10) "-3.6888685"
string(35) "
Perea & Asociados Abogados"
string(16) "+34 915 74 81 39"
string(27) "Profesor Waksman, 3 - 2º B"
string(6) "Madrid"
string(10) "40.4562278"
string(10) "-3.6893621"
string(35) "
Dlg Abogados Y Economistas"
string(16) "+34 915 70 42 34"
string(20) "Calle Espronceda, 12"
string(6) "Madrid"
string(10) "40.4406084"
string(10) "-3.6982083"
string(21) "
iAbogado.com"
string(16) "+34 917 48 93 57"
string(38) "Paseo de la Castellana 179, esc. C, 1C"
string(6) "Madrid"
string(9) "40.462305"
string(10) "-3.6917305"
string(19) "
Alcalá 59"
string(16) "+34 917 81 29 53"
string(19) "C/ Alcalá, 59, 5º"
string(6) "Madrid"
string(10) "40.4198035"
string(10) "-3.6913739"
string(46) "
ABOGADOS PENALISTAS - Abogados Grande"
string(16) "+34 655 19 39 20"
string(36) "Calle Fernán González 36, 2º izq."
string(6) "Madrid"
string(10) "40.4207393"
string(17) "-3.67457060000004"
string(37) "
Gutiérrez Y Riesgo Abogados"
string(16) "+34 675 95 41 04"
string(25) "Ronda Segovia, 22 - 1º B"
string(6) "Madrid"
string(10) "40.4083451"
string(10) "-3.7163378"
string(30) "
Lucas Franco Abogados"
string(16) "+34 600 85 86 86"
string(27) "C/ Espronceda, 39 3º,dcha."
string(6) "Madrid"
string(10) "40.4405395"
string(17) "-3.69395450000002"
string(25) "
Lextime Abogados"
string(16) "+34 914 00 88 66"
string(27) "Calle Máiquez, 18 - Local "
string(6) "Madrid"
string(10) "40.4208712"
string(10) "-3.6729907"
Pregunta: ¿Como lo inserto en una tabla de mi BD?
Gracias de antemano