Esempio n. 1
0
function image_retrieval($features, $max = 100)
{
    $ret = '';
    $query_args = array("url" => "http://cml10.csie.ntu.edu.tw:5000/", "post" => true, "params" => array("feature" => $features, "max" => $max));
    $xml_ret = query_cbir_service($query_args);
    if (!empty($xml_ret)) {
        $parser = new xml_parser();
        $ret = $parser->parse($xml_ret);
    }
    return $ret;
}
Esempio n. 2
0
}
$post_input = implode("\r\n", file('php://input'));
file_put_contents('/tmp/' . $file_date . '-a.xml', $post_input);
switch ($_SERVER['CONTENT_TYPE']) {
    case 'application/vnd.syncml+wbxml':
        $post_input = wbxml_decode($post_input);
    case 'application/vnd.syncml+xml':
        $parser = new xml_parser();
        $response = new syncml_response();
        break;
    default:
        exit('I\'m a SyncML server (2)');
}
$message = new syncml_message();
// the header
$header = $parser->parse($post_input, new xml_offset_mapper(array('SYNCML', 'SYNCHDR')));
$message->process_header($header);
unset($header);
// the body
$body = $parser->parse($post_input, new xml_offset_mapper(array('SYNCML', 'SYNCBODY')));
$message->process_body($body);
unset($body, $GLOBALS['HTTP_RAW_POST_DATA']);
// execute and print everything
$message->execute($response);
$response->print_response();
file_put_contents('/tmp/' . $file_date . '-b.xml', ob_get_contents() . "\n");
if ($_SERVER['CONTENT_TYPE'] == 'application/vnd.syncml+wbxml') {
    // remove the xml declaration tag
    $xml = substr(ob_get_clean(), 38);
    ob_start();
    // replace some bogus FPI values