save results

Hello the script creates a xml file and loads it into the Grid:

[code]<?php
ob_start();
require_once(“config.php”);
$postgre_connections = “host=localhost port=5432 dbname=db user=user password=pass”;
$res=pg_connect($postgre_connections);
//$key = $_POST[“key”];
$key = “uzel_ucheta”;
require(“…/codebase/grid_connector.php”);
require(“…/codebase/db_postgre.php”);

$grid = new GridConnector($res, “Postgre”);
$grid->dynamic_loading(100);
$grid->render_table($key, “objectid”, “objectid, nomin_diametr, mezhpower_interval, data_sled_prover, tip, marka, registr_nomer, rashod_max, rashod_min, nalich_korrectora, izgotovitel, konec_garantii, orig_fid, id_parent”);[/code]

How I Can save result in another xml file?

There is a beforeOutput server side event. You can use it to obtain and store the generated xml.

docs.dhtmlx.com/connector__php__ … event.html

Event handler function will receive two parameters - connector object and generated data.

Ok, now my code looks like:

require_once("config.php");
$postgre_connections = "host=localhost port=5432 dbname=dbname user=user password=pass";
$res=pg_connect($postgre_connections);
//$key = $_POST["key"];
$key = "uzel_ucheta";
require("../codebase/grid_connector.php");
require("../codebase/db_postgre.php");

function transfer_into_file(){
    ob_start();
    ob_clean();
    echo "test";
    $content = ob_get_contents();
    ob_end_clean();
    $file = fopen("test.xml","w+");
    fputs($file,$content);
    fclose($file);
}


$grid = new GridConnector($res, "Postgre");
$grid->event->attach("beforeOutput","transfer_into_file");
$grid->dynamic_loading(100);
$grid->render_table($key);

And there is a line “test” in the file test.xml, but I need that there was a xml-code, that I see in my browser, if I run this file

Try to use

function transfer_into_file($conn, $out){
    file_put_contents( "text.xml", (string)$out );
}