No es excesivamente complejo lo que quiero hacer, crear una pagina "index.php" (por ejemplo) y hacer que se acceda a ella introduciendole unos parametros por la url
"www.yoquese/index.php&variable1=2&variable2=papichulo"
Luego, las capturo y las proceso en el codigo PHP (mi intención es hacer una consulta en una DB en firebird) y devolver un documento xml.
¿Problemas?
Con el XML y el PHP todos.
Ya que si he encontrado como tratar la consulta y demás, pero para crear el archivo XML me las estoy viendo y deseando, a parte de que en este campo soy totalmente novato y no me deja usar las instrucciones.
Uso PHP 5.1.4 y me dice que :
Loaded extensions :
bcmath, calendar, com_dotnet, ctype, date, ftp, hash, iconv, odbc, pcre, Reflection, session, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter, apache, gettext, interbase, mbstring, mysql, mysqli, xmlrpc
Pero siguiendo el siguiente ejemplo:
Código PHP:
<?php
include "libreria_web.php";// query database for records
$query = "SELECT ref_type, id_part_type, xml_tag FROM technical_items WHERE xml_tag<>''";
$consulta = consulta_bd($query);
while ($fila = ibase_fetch_object ($consulta))
{
// create DomDocument object
$doc = domxml_new_doc("1.0");
// add root node
$root = $doc->add_root("reference");
// iterate through result set
while(list($ref_num, $id_part_type, $xml_tag) = ibase_fetch_row($result))
{
// create item node
$record = $root->new_child("reference", "");
$record->set_attribute("ref_num", $ref_num);
// attach title and artist as children of item node
$record->new_child("id_part_type", $id_part_type);
$record->new_child("xml_tag", $xml_tag);
}
// print the tree
echo $doc->dumpmem();
}
?>
Que está basado en:
Código PHP:
<?php
// query database for records
$connection = mysql_connect("cdserver", "joe", "cool") or die ("Unable toconnect!");
mysql_select_db("db712") or die ("Unable to select database!");
$query = "SELECT id, title, artist FROM cds";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
if (mysql_num_rows($result) > 0)
{
// create DomDocument object
$doc = new_xmldoc("1.0");
// add root node
$root = $doc->add_root("cds");
// iterate through result set
while(list($id, $title, $artist) = mysql_fetch_row($result))
{
// create item node
$record = $root->new_child("cd", "");
record->set_attribute("id", $id);
// attach title and artist as children of item node
$record->new_child("title", $title);
$record->new_child("artist", $artist);
}
// print the tree
echo $doc->dumpmem();
}
// close connection
mysql_close($connection);
?>
Obviamente el primero lo he modificado según mi (bastante nulo) criterio, pero bueno, hasta aquí puedo leer.
¿Sugerencias?
Saluditos a todos los del foro, que sois unos cracks.