当前位置: 首页>>代码示例>>PHP>>正文


PHP connector::set方法代码示例

本文整理汇总了PHP中connector::set方法的典型用法代码示例。如果您正苦于以下问题:PHP connector::set方法的具体用法?PHP connector::set怎么用?PHP connector::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connector的用法示例。


在下文中一共展示了connector::set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Uuid

 if (isset($data->spatial_res_value)) {
     $spatial_res_value = $data->spatial_res_value;
 }
 if (isset($data->inspire_charset)) {
     $inspire_charset = $data->inspire_charset;
 }
 if (isset($data->update_frequency)) {
     $update_frequency = $data->update_frequency;
 }
 $randomid = new Uuid();
 //Check if origin is external and export2csw is activated!
 if ($origin == 'external' && $export2csw == 't') {
     //harvest link from location, parse the content for datasetid and push xml into data column
     //load metadata from link TODO: function from class_wms - generate a class for metadata management and include it here and in class_wms
     $metadataConnector = new connector();
     $metadataConnector->set("timeOut", "5");
     $metaData = $metadataConnector->load($link);
     //$e = new mb_exception($metaData);
     if (!$metaData) {
         abort(_mb("Could not load metadata from source url!"));
     }
     //***
     //write metadata to temporary file:
     $randomFileId = new Uuid();
     $tmpMetadataFile = fopen(TMPDIR . '/link_metadata_file_' . $randomFileId . '.xml', 'w');
     fwrite($tmpMetadataFile, $metaData);
     fclose($tmpMetadataFile);
     $e = new mb_exception("File which has been written: link_metadata_file_" . $randomFileId . ".xml");
     //read out objects from xml structure
     if (file_exists(TMPDIR . '/link_metadata_file_' . $randomFileId . '.xml')) {
         $iso19139Xml = simplexml_load_file(TMPDIR . '/link_metadata_file_' . $randomFileId . '.xml');
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:31,代码来源:mb_metadata_server.php

示例2: validateInspireMetadataFromData

function validateInspireMetadataFromData($iso19139Xml)
{
    $validatorUrl = 'http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire';
    #$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php'; //for debugging purposes
    //send inspire xml to validator and push the result to requesting user
    $validatorInterfaceObject = new connector();
    $validatorInterfaceObject->set('httpType', 'POST');
    $validatorInterfaceObject->set('httpContentType', 'multipart/form-data');
    # maybe given automatically
    //first test with data from ram - doesn't function :-(
    $fields = array('dataFile' => urlencode($iso19139Xml));
    //generate file identifier:
    $fileId = guid();
    //generate temporary file under tmp
    if ($h = fopen(TMPDIR . "/" . $fileId . "iso19139_validate_tmp.xml", "w")) {
        if (!fwrite($h, $iso19139Xml)) {
            $e = new mb_exception("geoportal/mod_readOpenSearchResultsDetail.php: cannot write to file: " . TMPDIR . "iso19139_validate_tmp.xml");
        }
        fclose($h);
    }
    //send file as post like described under http://www.tecbrat.com/?itemid=13&catid=1
    $fields['dataFile'] = '@' . TMPDIR . '/' . $fileId . 'iso19139_validate_tmp.xml';
    $postData = $fields;
    $validatorInterfaceObject->set('httpPostFieldsNumber', count($postData));
    $validatorInterfaceObject->set('curlSendCustomHeaders', false);
    $validatorInterfaceObject->set('httpPostData', $postData);
    #give an array
    $validatorInterfaceObject->load($validatorUrl);
    header("Content-type: text/html; charset=UTF-8");
    echo $validatorInterfaceObject->file;
    //delete file in tmp
    //TODO - this normally done by a cronjob
    die;
}
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:34,代码来源:mod_readOpenSearchResultsDetail.php

示例3: post

 protected final function post($url, $postData)
 {
     $connection = new connector();
     $connection->set("httpType", "post");
     $connection->set("httpContentType", "xml");
     $connection->set("httpPostData", $postData);
     $e = new mb_notice("OWS REQUEST: " . $url . "\n\n" . $postData);
     $data = $connection->load($url);
     if (!$data) {
         $e = new mb_exception("OWS request returned no result: " . $url . "\n" . $postData);
         return null;
     }
     return $data;
 }
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:14,代码来源:class_ows.php

示例4: getrecords_post

function getrecords_post($url, $postData)
{
    $connection = new connector();
    $connection->set("httpType", "post");
    $connection->set("httpContentType", "text/xml");
    $connection->set("httpPostData", $postData);
    $e = new mb_notice("CAT REQUEST: " . $url . "\n\n" . $postData);
    $data = $connection->load($url);
    if (!$data) {
        $e = new mb_exception("CAT getrecords returned no result: " . $url . "\n" . $postData);
        return null;
    }
    return $data;
}
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:14,代码来源:mod_searchCatQueryBuilder_server.php

示例5: createCSWRecordFromXML

 /**
  * Create cswrecord object from GetRecords XML response
  * @return unknown_type
  * @param $url URL of getrecords
  * @param $xml Post, SOAP XML
  * @todo handle XML for POST,SOAP
  */
 public function createCSWRecordFromXML($url, $xml = null)
 {
     //create connector
     $data = null;
     //@todo handle post,soap
     if ($xml != null) {
         $connection = new connector();
         $connection->set("httpType", "post");
         $connection->set("httpContentType", "text/xml");
         $connection->set("httpPostData", $xml);
         $data = $connection->load($url);
         //$e = new mb_exception("class_cswrecord:url:".$url);
         $e = new mb_exception("class_cswrecord:xml:" . $xml);
         //$e = new mb_exception("class_cswrecord:data:".$data);
         $e = new mb_exception("class_cswrecord.php: responded data: " . $data);
     } else {
         $x = new connector($url);
         //$e = new mb_exception("class_cswrecord.php: requested url: ".$url);
         $data = $x->file;
         $e = new mb_exception("class_cswrecord.php: responded data: " . $data);
     }
     if (!$data) {
         $this->getrecords_status = false;
         $e = new mb_exception("CAT getrecords returned no result: " . $url . "\n" . $postData);
         return false;
     } else {
         $this->getrecords_status = true;
     }
     //check if returned string has an exeption defined
     $testException = strpos($data, "ows:Exception");
     if ($testException === false) {
     } else {
         $this->getrecords_status = true;
         $this->getrecords_exception = true;
         $this->getrecords_exception_text = urlencode($data);
         $e = new mb_exception("CAT getrecords returned an ows:exception!");
         return false;
     }
     //arrays to hold xml struct values and index
     $value_array = null;
     $index_array = null;
     //operational vars
     $op_type = null;
     //get-capabilities, getrecords ...
     $op_sub_type = null;
     //get,post,....
     $op_constraint = false;
     //Store XML response
     //@todo cache this
     $this->getRecordsDoc = $data;
     $parser = xml_parser_create("");
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
     xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, CHARSET);
     xml_parse_into_struct($parser, $data, $value_array, $index_array);
     //echo "values:".print_r($value_array);
     //echo "index:".print_r($vindex_array);
     $code = xml_get_error_code($parser);
     if ($code) {
         $line = xml_get_current_line_number($parser);
         $mb_exception = new mb_exception(xml_error_string($code) . " in line " . $line);
     }
     xml_parser_free($parser);
     foreach ($value_array as $element) {
         //Version 2.0.2
         //@todo: handle other profiles
         if ((mb_strtoupper($element[tag]) == "CSW:SEARCHRESULTS" or mb_strtoupper($element[tag]) == "SEARCHRESULTS") && $element[type] == "open") {
             $this->elementSet = $element[attributes][elementSet];
             $this->numberOfRecordsMatched = $element[attributes][numberOfRecordsMatched];
         }
         if ((mb_strtoupper($element[tag]) == "CSW:SUMMARYRECORD" or mb_strtoupper($element[tag]) == "SUMMARYRECORD") && $element[type] == "open") {
             //Create SummaryRecords Object
             $summaryObj = new cswSummaryRecord();
         }
         //SummaryRecord elements
         //ID
         if (mb_strtoupper($element[tag]) == "DC:IDENTIFIER" or mb_strtoupper($element[tag]) == "IDENTIFIER") {
             $summaryObj->identifier = $element[value];
         }
         //Title
         if (mb_strtoupper($element[tag]) == "DC:TITLE" or mb_strtoupper($element[tag]) == "TITLE") {
             $summaryObj->title = $element[value];
         }
         //@todo handle multiple subject elements
         //Subject
         if (mb_strtoupper($element[tag]) == "DC:SUBJECT" or mb_strtoupper($element[tag]) == "SUBJECT") {
             $summaryObj->subject = $element[value];
         }
         //Abstract
         if (mb_strtoupper($element[tag]) == "DC:ABSTRACT" or mb_strtoupper($element[tag]) == "ABSTRACT" or mb_strtoupper($element[tag]) == "DCT:ABSTRACT") {
             $summaryObj->abstract = $element[value];
         }
         //Modified
//.........这里部分代码省略.........
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:101,代码来源:class_cswrecord.php

示例6: validateInspireMetadata

function validateInspireMetadata($iso19139Doc, $recordId)
{
    $validatorUrl = 'http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire';
    #$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php';
    //send inspire xml to validator and push the result to requesting user
    $validatorInterfaceObject = new connector();
    $validatorInterfaceObject->set('httpType', 'POST');
    #$validatorInterfaceObject->set('httpContentType','application/xml');
    $validatorInterfaceObject->set('httpContentType', 'multipart/form-data');
    # maybe given automatically
    $xml = fillISO19139($iso19139Doc, $recordId);
    //first test with data from ram - doesn't function
    $fields = array('dataFile' => urlencode($xml));
    //generate file identifier:
    $fileId = guid();
    //generate temporary file under tmp
    if ($h = fopen(TMPDIR . "/" . $fileId . "iso19139_validate_tmp.xml", "w")) {
        if (!fwrite($h, $xml)) {
            $e = new mb_exception("mod_layerISOMetadata: cannot write to file: " . TMPDIR . "iso19139_validate_tmp.xml");
        }
        fclose($h);
    }
    //send file as post like described under http://www.tecbrat.com/?itemid=13&catid=1
    $fields['dataFile'] = '@' . TMPDIR . '/' . $fileId . 'iso19139_validate_tmp.xml';
    #if we give a string with parameters
    #foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    #rtrim($fields_string,'&');
    #$postData = $fields_string;
    $postData = $fields;
    #$e = new mb_exception("mod_layerISOMetadata: postData: ".$postData['dataFile']);
    //number of post fields:
    //curl_setopt($ch,CURLOPT_POST,count($fields));
    $validatorInterfaceObject->set('httpPostFieldsNumber', count($postData));
    $validatorInterfaceObject->set('curlSendCustomHeaders', false);
    //$validatorInterfaceObject->set('httpPostData', $postData);
    $validatorInterfaceObject->set('httpPostData', $postData);
    #give an array
    $validatorInterfaceObject->load($validatorUrl);
    header("Content-type: text/html; charset=UTF-8");
    echo $validatorInterfaceObject->file;
    //delete file in tmp
    //TODO - this normally done by a cronjob
    die;
}
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:44,代码来源:mod_layerISOMetadata.php

示例7: post

 /**
  * Retrieves a document from a URL, presumably a 
  * describe feature type document, via POST
  * 
  * @return String
  * @param $url String
  */
 protected final function post($url, $postData)
 {
     $x = new connector();
     $x->set("httpType", "post");
     $x->set("httpPostData", $postData);
     $x->set("httpContentType", "XML");
     $xml = $x->load($url);
     if (!$xml) {
         throw new Exception("Unable to open document: " . $url);
         return null;
     }
     return $xml;
 }
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:20,代码来源:class_ows_factory.php


注:本文中的connector::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。