Interesting !
Your code looks tidy. what about packaging it as a regular plugin (easier install & could have settings pages) ?
We started a plugin to get search results as JSON using the feed feature of Osclass. It is early work in progress but basically, it works like this :
function mdh_api_search() {
$params = Params::getParamsAsArray();
unset($params["sFeed"]);
$params["location"] = str_replace(",","-",$params["location"]);
$params["location"] = str_replace(" ","",$params["location"]);
$data["url"] = osc_search_url($params);
$data["title"] = meta_title();
$data["results"] = getContent(getPath("search-results.php"));
header('Content-type: text/json; charset=utf-8');
echo (json_encode( $data));
}
osc_add_hook("feed_api", "mdh_api_search");
Don't know if this is the way to go.