lolaina me devuelve este error:
Warning: PDOStatement::execute() expects parameter 1 to be array, string given in /home/ubicator/public_html/ext.php on line 52.
Siguiendo las indicaciones, el código ha quedado así:
Código PHP:
Ver original<?php
$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');
$username = 'mi_usuario';
$password = 'mi_contraseña';
$connection = new PDO('mysql:host=localhost;dbname=mi_base_datos', $username, $password);
$statement = $connection->prepare('INSERT INTO markersprueba (name, phone, address, city, lat, lng) VALUES(?,?,?,?,?,?)');
foreach ($titulos as $titulo){
$statement->execute($titulo->nodeValue);
}
?>
¿En que estoy fallando?