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


PHP XmlParser::xml2array方法代码示例

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


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

示例1: array

 /**
  *  Block Send XML order to Moulton
  *  @author Oleg D.
  */
 function send_order()
 {
     $result = array();
     $xml_order = $this->build_order_xml();
     $xml_order = preg_replace("/(\\s+)?(\\<.+\\>)(\\s+)?/", "\$2", $xml_order);
     $xml_order = str_replace('&', '&amp;', $xml_order);
     echo $xml_order;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_order);
     if ($this->testing) {
         curl_setopt($ch, CURLOPT_URL, $this->send_order_url_test);
     } else {
         curl_setopt($ch, CURLOPT_URL, $this->send_order_url);
     }
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, TRUE);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
     $moulton_answer = curl_exec($ch);
     curl_close($ch);
     include 'xmlparser.class.php';
     $Parser = new XmlParser();
     $result = $Parser->xml2array($moulton_answer);
     return $result;
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:29,代码来源:class.MoultonAPI.php

示例2: getLogs

 /**
  * get logs of the log file
  * @param $type string of log direcroty, like store
  * @param $logFile - log files name like 12.27.2009.xml
  * @param $userID
  * @author Oleg D.
  */
 function getLogs($type, $logFile, $userID = null)
 {
     $logFile .= '.xml';
     $date = explode('.', $logFile);
     $year = $date[2];
     $month = $date[0];
     App::import('Vendor', 'XmlParser', array('file' => 'xmlparser.class.php'));
     $XmlParser = new XmlParser();
     $file = file_get_contents(ROOT . DS . 'app' . DS . 'logs' . DS . $type . DS . $year . DS . $month . DS . $logFile);
     $file = str_replace('&', 'and', $file);
     if (!$file) {
         echo 'file error';
         exit;
     }
     $file = '<All>' . $file . '</All>';
     $logsParse = $XmlParser->xml2array($file);
     $logs = array();
     if (isset($logsParse['All']['Log'])) {
         $logs = $logsParse['All']['Log'];
     }
     if ($userID) {
         $myLogs = array();
         foreach ($logs as $log) {
             if ($log['Uid'] == $userID) {
                 $myLogs[] = $log;
             }
         }
     } else {
         $myLogs = $logs;
     }
     $myLogs = array_reverse($myLogs);
     //echo "<pre>";
     //print_r($myLogs);
     return $myLogs;
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:42,代码来源:LoggerComponent.php

示例3: loadFromData

 /**
  * 从XML文件读取信息
  * @param string $data XML数据
  * @param string $startNode 返回结果的起始节点
  * @return array 返回XML内容数组
  */
 function loadFromData($data, $startNode = '')
 {
     if (isset($data)) {
         $xml = XmlParser::xml2array($data);
         if ($startNode) {
             $startNode = explode('/', $startNode);
             foreach ($startNode as $node) {
             }
             $xml = isset($xml[$node]) ? $xml = $xml[$node] : array();
         }
     } else {
         $xml = array();
     }
     return $xml;
 }
开发者ID:hongweipeng,项目名称:screen,代码行数:21,代码来源:Account99u.class.php

示例4: cronUpdateVideoStatus

 /**
  * CRON update video process status
  * @author Oleg D.
  */
 function cronUpdateVideoStatus()
 {
     Configure::write('debug', 1);
     // set is_processed for all videos who uploaded mor then 15 minutes ago
     $sql = "UPDATE videos SET  is_processed = 1 WHERE uploaded AND is_processed = 0  AND uploaded < date_add(now(), interval -25 minute)";
     $this->Video->query($sql);
     App::import('Vendor', 'XmlParser', array('file' => 'xmlparser.class.php'));
     $XmlParser = new XmlParser();
     $videos = $this->Video->find('all', array('conditions' => array('is_processed' => 0, 'is_deleted' => 0, 'is_file' => 1, 'youtube_id is not null')));
     //pr($videos);
     foreach ($videos as $video) {
         if ($video['Video']['youtube_id']) {
             $content = $this->file_get_contents_curl('http://gdata.youtube.com/feeds/api/videos/' . $video['Video']['youtube_id']);
             $ansverArray = $XmlParser->xml2array($content);
             if (!empty($ansverArray['entry'])) {
                 if (!empty($ansverArray['entry']['app:control']['yt:state_attr'])) {
                     //echo "processing";
                     echo $video['Video']['youtube_id'] . ' - ' . 'processing<br/>';
                 } else {
                     //echo "processing finished";
                     $this->Video->save(array('id' => $video['Video']['id'], 'is_processed' => 1));
                     echo $video['Video']['youtube_id'] . ' - ' . 'processed<br/>';
                 }
             }
         }
     }
     Cache::delete('last_videos');
     exit;
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:33,代码来源:VideosController.php

示例5: getTwitterInfo

 /**
  * Get Twitter information
  * @author Oleg D.
  */
 function getTwitterInfo($twitterID)
 {
     App::import('Vendor', 'XmlParser', array('file' => 'xmlparser.class.php'));
     $XmlParser = new XmlParser();
     for ($i = 0; $i < 5; $i++) {
         $info = $this->file_get_contents_curl('http://api.twitter.com/1/users/show.xml?user_id=' . $twitterID);
         $info = $XmlParser->xml2array($info);
         if (!empty($info['user']['id'])) {
             break;
         }
     }
     if (!empty($info['user'])) {
         $info = $info['user'];
     } else {
         return false;
     }
     return $info;
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:22,代码来源:User.php


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