<?php
require_once(dirname(__FILE__) . "/../../wsbin/lib/nusoap.php");
require_once(dirname(__FILE__) . "/../../wsbin/ws_functions.php");
require_once(dirname(__FILE__) . "/../functions/tool_functions.php");

$ret = array(
	"result"	=> 0,
	"categs"	=> array()
);
$yp_categs = array();
$term = trim($_POST['term']);

$_request = array(
	"term" 			=> "$term"
);

$ws_request = array(
	'server_name' 		=> 'yellowpages',
	'function_name'		=> 'getBLCategories',
	'function_params'	=> base64_encode(serialize($_request))
);

$webservices_url = "https://www.apps24.com/srvdispatcher.php?wsdl";
$yp_categs = send_WS_Request($webservices_url, $ws_request);
if(is_array($yp_categs) && count($yp_categs)>0) {
	$ret['result'] = 1;
	$ret['categs'] = $yp_categs;
}

echo json_encode($ret);
?>