• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XMLParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _loadXML

 /**
  * ModuleOpenImmo::_loadXML
  *
  * Returns an array containing the xml data
  * @param fileName
  * @returns array
  **/
 public function _loadXML($fileName = NULL)
 {
     // load xml file
     $sXML = NULL;
     $sXML = @file_get_contents(TL_ROOT . DIRECTORY_SEPARATOR . $fileName);
     if (!empty($sXML)) {
         // check for known namespaces
         $knownNameSpace = false;
         foreach ($this->aAllowedNamespaces as $nameSpace) {
             if (strpos($sXML, '<' . $nameSpace . ':') !== FALSE) {
                 $knownNameSpace = true;
                 // strip namespace from xml
                 $sXML = str_replace(array('<' . $nameSpace . ':', '</' . $nameSpace . ':'), array('<', '</'), $sXML);
             }
         }
         // no of the known namespaces given? NOT VALID!
         if (!$knownNameSpace) {
             return false;
         }
         // parse our xml into an array
         $oXML = NULL;
         $oXML = new XMLParser();
         $aXML = array();
         $aXML = $oXML->xmlToArray($sXML);
         // strip our root node and return xml
         if (!empty($aXML)) {
             $rootNodeName = array_keys($aXML);
             $rootNodeName = $rootNodeName[0];
             $aXML = $aXML[$rootNodeName][0];
             return $aXML;
         }
     }
     return false;
 }
开发者ID:numero2,项目名称:contao-openimmo,代码行数:41,代码来源:ModuleOpenImmo.php


示例2: thor_build_display_values

	function thor_build_display_values()
	{
		$form = new entity($this->form_id);
		$form->get_values();
		if ($form->get_value('type') != id_of('form'))
		{
			trigger_error('the thor viewer was passed an invalid id ('.$form_id.') - it must be passed the ID of a reason form entity');
		}
		else
		{
			$form_xml_obj = new XMLParser($form->get_value('thor_content'));
			$form_xml_obj->Parse();
			$display_values = array();
			foreach ($form_xml_obj->document->tagChildren as $k=>$v)
			{
				$tagname = is_object($v) ? $v->tagName : '';
				if (method_exists($this, '_build_display_'.$tagname))
				{
					$build_function = '_build_display_'.$tagname;
					$display_values = array_merge($display_values, $this->$build_function($v));
				}
			}
		}
		foreach ($this->extra_fields as $field_name)
		{
			$display_values[$field_name]['label'] = prettify_string($field_name);
			$display_values[$field_name]['type'] = 'text';
		}
		$this->_display_values = (isset($display_values)) ? $display_values : array();
	}
开发者ID:natepixel,项目名称:reason_package,代码行数:30,代码来源:thor_viewer.php


示例3: parseEmails

 /**
  * Parse into structures the XML contents of an email data file.
  * @param $contents string
  * @return array
  */
 function parseEmails($contents)
 {
     $parser = new XMLParser();
     $result = $parser->parseTextStruct($contents, array('email_text', 'subject', 'body'));
     $parser->destroy();
     return $result;
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:12,代码来源:genEmailUpdates.php


示例4: ask_eve_central

/**
 *	Query EVE Central's XML feed.
 */
function ask_eve_central($item_id)
{
    file_put_contents(KB_CACHEDIR . '/evecentral/activity.log', "Handling from live.\n", FILE_APPEND);
    $query = DBFactory::getDBQuery();
    if (function_exists('curl_init')) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://api.eve-central.com/api/marketstat?regionlimit=10000002&typeid=" . $item_id . "");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $content = curl_exec($ch);
        curl_close($ch);
    } else {
        $file = fopen("http://api.eve-central.com/api/marketstat?regionlimit=10000002&typeid=" . $item_id . "", "r");
        if (!$file) {
            return -99;
        }
        $content = stream_get_contents($file);
        fclose($file);
    }
    if (strpos($content, '</evec_api>') == false) {
        return -99;
    } else {
        $parse = new XMLParser();
        $parse->preparseXML();
        $parse->parseXML($content);
        $values = $parse->get_data();
        if (0 == $values['WEIGHTED']) {
            return -99;
        }
        $weighted_average = $values['WEIGHTED'];
    }
    file_put_contents(KB_CACHEDIR . '/evecentral/activity.log', "{$content}\n", FILE_APPEND);
    $query->execute("REPLACE INTO kb3_eve_central (item_id, item_price) VALUES ({$item_id}, '{$weighted_average}')");
    return $weighted_average;
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:37,代码来源:eve_central_sync.php


示例5: getFAQ

 public static function getFAQ()
 {
     if (!($data = @file_get_contents(self::getFilename()))) {
         throw new ErrorException(self::ERROR_READING_FILE);
     }
     /**
      * Let's replace some of the docbook tags and wrap some HTML-entities
      * inside CDATA containers.
      */
     $pattern = array('/<ulink\\s+url="(.+)">(.+)<\\/ulink>/isU', '/<itemizedlist>(.+)<\\/itemizedlist>/isU', '/<listitem><simpara>(.+)<\\/simpara><\\/listitem>/isU', '/<simpara>(.+)<\\/simpara>/isU', '/<emphasis>(.+)<\\/emphasis>/isU', '/<envar>(.+)<\\/envar>/isU', '/<command(?:\\s+[^>]+)?>(.+)<\\/command>/isU', '/<blockquote>(.+)<\\/blockquote>/isU', '/<programlisting(?:\\s+[^>]+)?>(.+)<\\/programlisting>/isU', '/<quote>(.+)<\\/quote>/isU', '/<xref linkend="(.+)"\\s+endterm=".+"\\/>/isU', '/(&(?:lt|gt|quot);)/is');
     $replace = array('<h:a href="\\1">\\2</h:a>', '<h:ul>\\1</h:ul>', '<h:li>\\1</h:li>', '<h:p>\\1</h:p>', '<h:span class="italic">\\1</h:span>', '<h:span class="envar">\\1</h:span>', '<h:span class="bold">\\1</h:span>', '<h:blockquote>\\1</h:blockquote>', '<h:pre>\\1</h:pre>', '&#8220;<h:span class="quote">\\1</h:span>&#8221;', '<h:a xref="\\1"/>', '<![CDATA[\\1]]>');
     $data = preg_replace($pattern, $replace, $data);
     /* Remove this weird character as it displays as À in Firefox. */
     $data = str_replace(chr(194), '', $data);
     /* Now parse the data. */
     $parser = new XMLParser();
     $a = $parser->parseByData($data);
     $sections = array();
     /**
      * Build a map of the defined hrefs so we can give the xrefs the correct
      * text.
      */
     $xref = array();
     $count = 1;
     foreach ($a['faq']['section'] as $data) {
         $sections[] = new QASection($data, $count++, $xref);
     }
     return $sections;
 }
开发者ID:bgK,项目名称:scummvm-web,代码行数:29,代码来源:FAQModel.php


示例6: sendHttp

 public function sendHttp($url, $connectTimeout = "", $timeout)
 {
     // verify that the URL uses a supported protocol.
     if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
         //Construct the payload to POST to the url.
         $data = $this->getRequestXml();
         // create a new cURL resource
         $ch = curl_init($url);
         // set URL and other appropriate options
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
         curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
         // Execute the request.
         $result = curl_exec($ch);
         $succeeded = curl_errno($ch) == 0 ? true : false;
         // close cURL resource, and free up system resources
         curl_close($ch);
         // If Communication was not successful set error result, otherwise
         if (!$succeeded) {
             $result = $this->setErrorResponse(CENTINEL_ERROR_CODE_8030, CENTINEL_ERROR_CODE_8030_DESC);
         }
         // Assert that we received an expected Centinel Message in reponse.
         if (strpos($result, "<CardinalMPI>") === false) {
             $result = $this->setErrorResponse(CENTINEL_ERROR_CODE_8010, CENTINEL_ERROR_CODE_8010_DESC);
         }
     } else {
         $result = $this->setErrorResponse(CENTINEL_ERROR_CODE_8000, CENTINEL_ERROR_CODE_8000_DESC);
     }
     $parser = new XMLParser();
     $parser->deserializeXml($result);
     $this->response = $parser->deserializedResponse;
 }
开发者ID:vishalpatel14,项目名称:indiankalaniketan,代码行数:35,代码来源:Client.php


示例7: array

 /**
  * Parse an XML file and return data in an array.
  * @see xml.XMLParser::parseStruct()
  */
 function &parseStruct($file, $tagsToMatch = array())
 {
     $parser = new XMLParser();
     $data =& $parser->parseStruct($file, $tagsToMatch);
     $parser->destroy();
     return $data;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:11,代码来源:XMLDAO.inc.php


示例8: __update_cache

 /**
  * Update currency cache
  */
 private function __update_cache($force = False)
 {
     if (!is_null($this->_cache) && !$force) {
         return;
     }
     $filename = $this->path . 'data/iso_currencies.xml';
     if (file_exists($filename)) {
         // get XML file
         $data = file_get_contents($filename);
         $xml = new XMLParser($data, $filename);
         $xml->Parse();
         $currencies = array();
         // create list with unique data
         foreach ($xml->document->tagChildren as $iso_currency) {
             // extract data
             $entity = $iso_currency->tagChildren[0]->tagData;
             $currency = $iso_currency->tagChildren[1]->tagData;
             $alphabetic_code = $iso_currency->tagChildren[2]->tagData;
             $numeric_code = $iso_currency->tagChildren[3]->tagData;
             $minor_unit = $iso_currency->tagChildren[4]->tagData;
             if ($numeric_code == '' || $alphabetic_code == 'XXX') {
                 continue;
             }
             $currencies[] = array('entity' => $entity, 'currency' => $currency, 'alphabetic_code' => $alphabetic_code, 'numeric_code' => $numeric_code, 'minor_unit' => $minor_unit);
             // update cache
             $this->_cache = $currencies;
         }
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:32,代码来源:shop_currencies_handler.php


示例9: installSettings

 /**
  * Install conference settings from an XML file.
  * @param $id int ID of scheduled conference/conference for settings to apply to
  * @param $filename string Name of XML file to parse and install
  * @param $paramArray array Optional parameters for variable replacement in settings
  */
 function installSettings($id, $filename, $paramArray = array())
 {
     $xmlParser = new XMLParser();
     $tree = $xmlParser->parse($filename);
     if (!$tree) {
         $xmlParser->destroy();
         return false;
     }
     foreach ($tree->getChildren() as $setting) {
         $nameNode =& $setting->getChildByName('name');
         $valueNode =& $setting->getChildByName('value');
         if (isset($nameNode) && isset($valueNode)) {
             $type = $setting->getAttribute('type');
             $isLocaleField = $setting->getAttribute('locale');
             $name =& $nameNode->getValue();
             if ($type == 'date') {
                 $value = strtotime($valueNode->getValue());
             } elseif ($type == 'object') {
                 $arrayNode =& $valueNode->getChildByName('array');
                 $value = $this->_buildObject($arrayNode, $paramArray);
             } else {
                 $value = $this->_performReplacement($valueNode->getValue(), $paramArray);
             }
             // Replace translate calls with translated content
             $this->updateSetting($id, $name, $isLocaleField ? array(Locale::getLocale() => $value) : $value, $type, $isLocaleField);
         }
     }
     $xmlParser->destroy();
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:35,代码来源:SettingsDAO.inc.php


示例10: testXml

 /**
  * 测试XML解析类
  */
 function testXml()
 {
     $xml = file_get_contents('temp.xml');
     $this->load->library('XMLParserLib');
     $parser = new XMLParser($xml);
     $parser->Parse();
     print_r($parser->document->globalinfo);
     //echo $parser->GenerateXML();
 }
开发者ID:zhaojianhui129,项目名称:rmp2016,代码行数:12,代码来源:nusoapClient.php


示例11: XMLParser

 /**
  * Parse a record's contents into an object
  * @param $contents string
  * @return object
  */
 function &parseContents(&$contents)
 {
     $xmlParser = new XMLParser();
     $result =& $xmlParser->parseText($contents);
     $returner = array();
     $returner =& $this->handleRootNode($result);
     $result->destroy();
     $xmlParser->destroy();
     return $returner;
 }
开发者ID:Rygbee,项目名称:harvester,代码行数:15,代码来源:ModsPlugin.inc.php


示例12: getAllArticles

 public static function getAllArticles()
 {
     $fname = DIR_DATA . '/press_articles.xml';
     $parser = new XMLParser();
     $a = $parser->parseByFilename($fname);
     $entries = array();
     foreach ($a['articles']['article'] as $key => $value) {
         $entries[] = new Article(array('name' => $value['name'], 'url' => $value['url'], 'language' => $value['language'], 'posted' => $value['posted']));
     }
     return $entries;
 }
开发者ID:rootfather,项目名称:scummvm-web,代码行数:11,代码来源:ArticleModel.php


示例13: testEmails

 function testEmails($locale, $referenceLocale)
 {
     import('install.Installer');
     // Bring in data dir
     $errors = array();
     $xmlParser = new XMLParser();
     $referenceEmails =& $xmlParser->parse(INSTALLER_DATA_DIR . "/data/locale/{$referenceLocale}/email_templates_data.xml");
     $emails =& $xmlParser->parse(INSTALLER_DATA_DIR . "/data/locale/{$locale}/email_templates_data.xml");
     $emailsTable =& $emails->getChildByName('table');
     $referenceEmailsTable =& $referenceEmails->getChildByName('table');
     $matchedReferenceEmails = array();
     // Pass 1: For all translated emails, check that they match
     // against reference translations.
     for ($emailIndex = 0; ($email =& $emailsTable->getChildByName('row', $emailIndex)) !== null; $emailIndex++) {
         // Extract the fields from the email to be tested.
         $fields = $this->extractFields($email);
         // Locate the reference email and extract its fields.
         for ($referenceEmailIndex = 0; ($referenceEmail =& $referenceEmailsTable->getChildByName('row', $referenceEmailIndex)) !== null; $referenceEmailIndex++) {
             $referenceFields = $this->extractFields($referenceEmail);
             if ($referenceFields['email_key'] == $fields['email_key']) {
                 break;
             }
         }
         // Check if a matching reference email was found.
         if (!isset($referenceEmail) || $referenceEmail === null) {
             $errors[EMAIL_ERROR_EXTRA_EMAIL][] = array('key' => $fields['email_key']);
             continue;
         }
         // We've successfully found a matching reference email.
         // Compare it against the translation.
         $bodyParams = $this->getParameterNames($fields['body']);
         $referenceBodyParams = $this->getParameterNames($referenceFields['body']);
         if ($bodyParams !== $referenceBodyParams) {
             $errors[EMAIL_ERROR_DIFFERING_PARAMS][] = array('key' => $fields['email_key'], 'mismatch' => array_diff($bodyParams, $referenceBodyParams));
         }
         $subjectParams = $this->getParameterNames($fields['subject']);
         $referenceSubjectParams = $this->getParameterNames($referenceFields['subject']);
         if ($subjectParams !== $referenceSubjectParams) {
             $errors[EMAIL_ERROR_DIFFERING_PARAMS][] = array('key' => $fields['email_key'], 'mismatch' => array_diff($subjectParams, $referenceSubjectParams));
         }
         $matchedReferenceEmails[] = $fields['email_key'];
         unset($email);
         unset($referenceEmail);
     }
     // Pass 2: Make sure that there are no missing translations.
     for ($referenceEmailIndex = 0; ($referenceEmail =& $referenceEmailsTable->getChildByName('row', $referenceEmailIndex)) !== null; $referenceEmailIndex++) {
         // Extract the fields from the email to be tested.
         $referenceFields = $this->extractFields($referenceEmail);
         if (!in_array($referenceFields['email_key'], $matchedReferenceEmails)) {
             $errors[EMAIL_ERROR_MISSING_EMAIL][] = array('key' => $referenceFields['email_key']);
         }
     }
     $this->displayEmailErrors($locale, $errors);
 }
开发者ID:jalperin,项目名称:harvester,代码行数:54,代码来源:localeCheck.php


示例14: getAllMenus

 public static function getAllMenus()
 {
     $fname = DIR_DATA . '/menus.xml';
     $parser = new XMLParser();
     $a = $parser->parseByFilename($fname);
     $entries = array();
     foreach ($a['menus']['group'] as $key => $value) {
         $entries[] = new MenuItem(array('name' => $value['name'], 'class' => $value['class'], 'link' => $value['link']));
     }
     return $entries;
 }
开发者ID:rootfather,项目名称:scummvm-web,代码行数:11,代码来源:MenuModel.php


示例15: getAllCredits

 public static function getAllCredits()
 {
     $fname = DIR_DATA . '/credits.xml';
     $parser = new XMLParser();
     $a = $parser->parseByFilename($fname);
     $sections = array();
     foreach ($a['credits']['section'] as $key => $value) {
         $sections[] = new CSection($value);
     }
     return $sections;
 }
开发者ID:rootfather,项目名称:scummvm-web,代码行数:11,代码来源:CreditsModel.php


示例16: getAllDocuments

 public static function getAllDocuments()
 {
     $fname = DIR_DATA . '/documentation.xml';
     $parser = new XMLParser();
     $a = $parser->parseByFilename($fname);
     $entries = array();
     foreach ($a['documentation']['document'] as $key => $value) {
         $entries[] = new Document($value);
     }
     return $entries;
 }
开发者ID:rootfather,项目名称:scummvm-web,代码行数:11,代码来源:DocumentationModel.php


示例17: XMLParser

 /**
  * Parse an RT version XML file.
  * @param $file string path to the XML file
  * @return RTVersion
  */
 function &parse($file)
 {
     $parser = new XMLParser();
     $tree = $parser->parse($file);
     $parser->destroy();
     $version = false;
     if ($tree !== false) {
         $version =& $this->parseVersion($tree);
     }
     $tree->destroy();
     return $version;
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:17,代码来源:RTXMLParser.inc.php


示例18: getAllDownloads

 public static function getAllDownloads()
 {
     $fname = DIR_DATA . '/downloads.xml';
     /* Now parse the data. */
     $parser = new XMLParser();
     $a = $parser->parseByFilename($fname);
     $sections = array();
     foreach ($a['downloads']['section'] as $key => $value) {
         $sections[] = new DSection($value);
     }
     return $sections;
 }
开发者ID:rootfather,项目名称:scummvm-web,代码行数:12,代码来源:DownloadsModel.php


示例19: task_versioncheck

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_versioncheck($task)
{
    global $cache, $lang, $mybb;
    $current_version = rawurlencode($mybb->version_code);
    $updated_cache = array('last_check' => TIME_NOW);
    // Check for the latest version
    require_once MYBB_ROOT . 'inc/class_xml.php';
    $contents = fetch_remote_file("http://www.mybb.com/version_check.php");
    if (!$contents) {
        add_task_log($task, $lang->task_versioncheck_ran_errors);
        return false;
    }
    $pos = strpos($contents, "<");
    if ($pos > 1) {
        $contents = substr($contents, $pos);
    }
    $pos = strpos(strrev($contents), ">");
    if ($pos > 1) {
        $contents = substr($contents, 0, -1 * ($pos - 1));
    }
    $parser = new XMLParser($contents);
    $tree = $parser->get_tree();
    $latest_code = (int) $tree['mybb']['version_code']['value'];
    $latest_version = "<strong>" . htmlspecialchars_uni($tree['mybb']['latest_version']['value']) . "</strong> (" . $latest_code . ")";
    if ($latest_code > $mybb->version_code) {
        $latest_version = "<span style=\"color: #C00;\">" . $latest_version . "</span>";
        $version_warn = 1;
        $updated_cache['latest_version'] = $latest_version;
        $updated_cache['latest_version_code'] = $latest_code;
    } else {
        $latest_version = "<span style=\"color: green;\">" . $latest_version . "</span>";
    }
    // Check for the latest news
    require_once MYBB_ROOT . "inc/class_feedparser.php";
    $feed_parser = new FeedParser();
    $feed_parser->parse_feed("http://feeds.feedburner.com/MyBBDevelopmentBlog");
    $updated_cache['news'] = array();
    require_once MYBB_ROOT . '/inc/class_parser.php';
    $post_parser = new postParser();
    if ($feed_parser->error == '') {
        foreach ($feed_parser->items as $item) {
            if (isset($updated_cache['news'][2])) {
                break;
            }
            $description = $item['description'];
            $description = $post_parser->parse_message($description, array('allow_html' => true));
            $description = preg_replace('#<img(.*)/>#', '', $description);
            $updated_cache['news'][] = array('title' => htmlspecialchars_uni($item['title']), 'description' => $description, 'link' => htmlspecialchars_uni($item['link']), 'author' => htmlspecialchars_uni($item['author']), 'dateline' => $item['date_timestamp']);
        }
    }
    $cache->update("update_check", $updated_cache);
    add_task_log($task, $lang->task_versioncheck_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:61,代码来源:versioncheck.php


示例20: fetchData

 /**
  * Parse and return DHL tracking details.
  *
  * @inheritdoc
  */
 public function fetchData($trackingNumber)
 {
     $link = 'http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=' . $trackingNumber;
     $html = $this->fetchUrl($link);
     if (!preg_match_all('#<input type="hidden" name="hdnXML([^"]+)" value="([^"]+)"/>#', $html, $matches, PREG_SET_ORDER)) {
         // XML tracking details not found
         return false;
     }
     $stats = array();
     $locations = array();
     $xml = '';
     foreach ($matches as $match) {
         $xml .= $match[2];
     }
     $xml = html_entity_decode($xml);
     $parser = new XMLParser();
     $obj = $parser->parse($xml);
     if (!isset($obj->track->trackshipments->shipment->result->code->data) && $obj->track->trackshipments->shipment->result->code->data != 1) {
         // XML document could not be parsed
         return false;
     }
     $stats['service'] = isset($obj->track->trackshipments->shipment->service->desc->data) ? $obj->track->trackshipments->shipment->service->desc->data : '';
     $stats['departure'] = isset($obj->track->trackshipments->shipment->pickup->date->data) ? $obj->track->trackshipments->shipment->pickup->date->data : '';
     $stats['destination'] = isset($obj->track->trackshipments->shipment->destinationdescr->location->data) ? $obj->track->trackshipments->shipment->destinationdescr->location->data : '';
     $stats['arrival'] = isset($obj->track->trackshipments->shipment->delivery->date->data) ? $obj->track->trackshipments->shipment->delivery->date->data : '';
     if (isset($obj->track->trackshipments->shipment->trackinghistory->status)) {
         if (!is_array($obj->track->trackshipments->shipment->trackinghistory->status)) {
             $obj->track->trackshipments->shipment->trackinghistory->status = array($obj->track->trackshipments->shipment->trackinghistory->status);
         }
         foreach ($obj->track->trackshipments->shipment->trackinghistory->status as $history) {
             $row = array();
             $row['location'] = $history->location->city->data . ', ';
             if (isset($history->location->state->data) && !empty($history->location->state->data)) {
                 $row['location'] .= $history->location->state->data . ', ';
             }
             if (isset($history->location->country->data) && !empty($history->location->country->data)) {
                 $row['location'] .= $history->location->country->data;
             }
             $row['location'] = rtrim($row['location'], ', ');
             $row['time'] = $history->date->data . ' ' . $history->time->data;
             $row['status'] = $history->statusdesc->data;
             $locations[] = $row;
             if (!isset($stats['status'])) {
                 $stats['status'] = $history->statusdesc->data;
             }
             if (!isset($stats['last_location'])) {
                 $stats['last_location'] = $row['location'];
             }
         }
     }
     return array('details' => $stats, 'locations' => $locations);
 }
开发者ID:RandomArray,项目名称:php-parcel-tracker,代码行数:57,代码来源:dhl.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XMLReader类代码示例发布时间:2022-05-23
下一篇:
PHP XMLElement类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap