-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_search.php
99 lines (76 loc) · 2.6 KB
/
main_search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
include 'config.php';
require 'libs/infoSource_engines.lib.php';
require 'libs/utiles.lib.php'; //pasar para lib
require 'libs/adaptors_interface.php';
require 'modulos/adaptadores/general_adaptor.php';
ini_set('display_errors', '1');
$template = 'main_search.tpl';
$tmpl = new SmartyCustom;
$errors= array();
$parametersValue_array= array(); //arreglo con los nombres de los param de un buscador y sus valores
$fi_manager = new InfoSourceEngineManager($mdb);
$opr='';
if ("GET" == $_SERVER['REQUEST_METHOD'])
{
$input = $_GET;
//$modos = array("General","Presentaciones","Documentos");
$client = new SoapClient($wsdl_path,array("trace"=>1, "exceptions"=>1));
$infosources = $client->listInfoSources();
foreach($infosources as $source)
{
$source->name = utf8_decode($source->name);
$source->description = utf8_decode($source->description);
}
$tmpl->assign('infosources',$infosources);
$tmpl->display($template);
}
else
{
$input = $_POST;
if(isset($input['queries']))
{
$query = $input['queries'];
$infoS_id = $input['infosources'];
$count_elem = 10;
$init_elem =1;
try
{
$query = Utiles::replace_acent($query);
$client = new SoapClient($wsdl_path,array("trace"=>1, "exceptions"=>1));
$result = $client->search($query, $infoS_id, $count_elem, $init_elem);
/*print_r($query);
print_r('<br>');
print_r($wsdl_path);
print_r('<br>');
print_r($infoS_id);
print_r('<br>');
print_r($count_elem);
print_r('<br>');
print_r($init_elem);
print_r('<br>');
print_r($result); exit;*/
$tmpl->assign('result',$result);
$tmpl->display("main_search_results.tpl");
//probando RSS
/* $results = $result["results"];
//obtener estos param mediante infoS_id;
$name = "NAME";
$description = "RESULTS";
$link = "http://buscador.sld.cu/main_search.php";
$syndicationURL = "http://buscador.sld.cu/main_search.php";
$adaptor = new GeneralAdaptor();
$adaptor->ToRSS($results, $name, $description, $link, $syndicationURL);*/
}
catch (SoapFault $fault)
{
echo $fault->faultstring;
print "<pre>\n";
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "Headers:\n".htmlspecialchars($client->__getLastRequestHeaders())."\n";
print "</pre>";
}
}
}
?>