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

PHP SimpleXMLElement类代码示例

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

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



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

示例1: encode

 public function encode(\Esendex\Model\DispatchMessage $message)
 {
     if (strlen($message->originator()) < 1) {
         throw new ArgumentException("Originator is invalid");
     }
     if (strlen($message->recipient()) < 1) {
         throw new ArgumentException("Recipient is invalid");
     }
     if ($message->validityPeriod() > 72) {
         throw new ArgumentException("Validity too long, must be less or equal to than 72");
     }
     $doc = new \SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><messages />", 0, false, Api::NS);
     $doc->accountreference = $this->reference;
     $child = $doc->addChild("message");
     $child->from = $message->originator();
     $child->to = $message->recipient();
     $child->body = $message->body();
     $child->type = $message->type();
     if ($message->validityPeriod() > 0) {
         $child->validity = $message->validityPeriod();
     }
     if ($message->language() != null) {
         $child->lang = $message->language();
     }
     return $doc->asXML();
 }
开发者ID:leqg,项目名称:leqg,代码行数:26,代码来源:DispatchXmlParser.php


示例2: __construct

 public function __construct($lg = 'fr')
 {
     parent::__construct($lg);
     $this->lg = URL . 't/' . $lg . '/';
     $base = $this->lg;
     $this->xmlOut = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     $this->xmlOut .= "<url><loc>{$base}</loc><priority>1.00</priority><changefreq>daily</changefreq></url>";
     $this->Gen();
     $this->xmlOut .= '</urlset>';
     $fileSitemap = BASE . 'sitemap.xml';
     $newXml = new SimpleXMLElement($this->xmlOut);
     $newXml->asXML($fileSitemap);
     $aL = $this->allLanguages;
     foreach ($aL as $k => $v) {
         parent::__construct($k);
         $this->lg = URL . 't/' . $k . '/';
         $base = $this->lg;
         $this->xmlOut = '';
         $this->xmlOut = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
         $this->xmlOut .= "<url><loc>{$base}</loc><priority>1.00</priority><changefreq>daily</changefreq></url>";
         $this->Gen();
         $this->xmlOut .= '</urlset>';
         $fileSitemap = BASE . 't/' . $k . '/sitemap.xml';
         $newXml = new SimpleXMLElement($this->xmlOut);
         $newXml->asXML($fileSitemap);
     }
 }
开发者ID:neoartdoo,项目名称:CMS,代码行数:27,代码来源:GenSitemapXml.php


示例3: export

 public function export(SimpleXMLElement $blockNode)
 {
     $stack = Stack::getByID($this->stID);
     if (is_object($stack)) {
         $blockNode->addChild('stack', '<![CDATA[' . $stack->getCollectionName() . ']]>');
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:7,代码来源:core_stack_display.php


示例4: toArray

 /**
  * Convert an XML document to a multi dimensional array
  * Pass in an XML document (or SimpleXMLElement object) and this recrusively loops through and builds a representative array
  *
  * @param string $xml - XML document - can optionally be a SimpleXMLElement object
  * @return array ARRAY
  */
 public static function toArray($xml)
 {
     if (is_string($xml)) {
         $xml = new SimpleXMLElement($xml);
     }
     $children = $xml->children();
     if (!$children) {
         return (string) $xml;
     }
     $arr = array();
     foreach ($children as $key => $node) {
         $node = ArrayToXML::toArray($node);
         // support for 'anon' non-associative arrays
         if ($key == 'anon') {
             $key = count($arr);
         }
         // if the node is already set, put it into an array
         if (isset($arr[$key])) {
             if (!is_array($arr[$key]) || !isset($arr[$key][0])) {
                 $arr[$key] = array($arr[$key]);
             }
             $arr[$key][] = $node;
         } else {
             $arr[$key] = $node;
         }
     }
     return $arr;
 }
开发者ID:carriercomm,项目名称:opengateway,代码行数:35,代码来源:arraytoxml.php


示例5: displayBookings

function displayBookings()
{
    $host;
    $user;
    $pswd;
    $dbnm;
    $connection = mysqli_connect($host, $user, $pswd, $dbnm) or die('Failed to connect.');
    $searchQuery = "SELECT * FROM bookings where status = 'unassigned'";
    $result = mysqli_query($connection, $searchQuery);
    $xml = new SimpleXMLElement('<xml/>');
    if (mysqli_num_rows($result) > 0) {
        while ($result_array = mysqli_fetch_array($result)) {
            $data = $xml->addChild('search');
            $data->addChild('bookingNumber', $result_array['bookingNumber']);
            $data->addChild('customerName', $result_array['customerName']);
            $data->addChild('pickupAddress', $result_array['pickupAddress']);
            $data->addChild('suburb', $result_array['suburb']);
            $data->addChild('destination', $result_array['destination']);
            $data->addChild('phoneNumber', $result_array['contactPhone']);
            $data->addChild('pickUpDate', $result_array['pickUpDate']);
            $data->addChild('pickUpTime', $result_array['pickUpTime']);
            $data->addChild('bookingDate', $result_array['bookingDate']);
            $data->addChild('bookingTime', $result_array['bookingTime']);
        }
    }
    echo $xml->asXML();
}
开发者ID:romangn,项目名称:Taxi-booking-system,代码行数:27,代码来源:showBookings.php


示例6: __construct

 /**
  * Parses the affix configuration.
  *
  * @param \SimpleXMLElement $date
  * @param array $additional Array with key form and value text or numeric
  */
 public function __construct(\SimpleXMLElement $date, array $additional)
 {
     $this->name = '';
     $this->delimiter = '–';
     $this->formatting = new Formatting($date);
     $this->textCase = new TextCase($date);
     $this->affix = new Affix($date);
     foreach ($date->attributes() as $name => $value) {
         switch ($name) {
             case 'name':
                 $this->name = (string) $value;
                 switch ($this->name) {
                     case 'day':
                         $this->render = Factory::day($additional['form'], $date);
                         break;
                     case 'month':
                         $this->render = Factory::month($additional['form'], $date);
                         break;
                     case 'year':
                         $this->render = Factory::year($additional['form'], $date);
                         break;
                 }
                 break;
             case 'range-delimiter':
                 $this->delimiter = (string) $value;
                 break;
         }
     }
 }
开发者ID:geissler,项目名称:csl,代码行数:35,代码来源:DatePart.php


示例7: processSvn2RssRequest

 /**
  * Starts the processing of the current rss-request.
  * Acts like some kind of a main-method, so manages the further control-flow.
  */
 public function processSvn2RssRequest($strFeedParam = "")
 {
     try {
         //start by loading the config-file
         $objConfig = new ConfigReader($strFeedParam);
         //create the svn-reader and pass control
         $objSvnReader = new SvnReader($objConfig);
         $strSvnLog = $objSvnReader->getSvnLogContent();
         //create rss-nodes out of the logfile
         $objRssConverter = new Log2RssConverter($objConfig);
         $objRssRootNode = $objRssConverter->generateRssNodesFromLogContent($strSvnLog);
         $this->strOutput = $objRssRootNode->asXML();
     } catch (Svn2RssException $objException) {
         //Wrap error-message as a rss-feed element, too
         $objFeedRootNode = new SimpleXMLElement("<rss version=\"2.0\"></rss>");
         $objChannel = $objFeedRootNode->addChild("channel");
         $objChannel->addChild("title", "Error");
         $objChannel->addChild("description", "Error while loading feed");
         $objChannel->addChild("link", "n.a.");
         $objChannel->addChild("pubDate", strftime("%a, %d %b %Y %H:%M:%S GMT", time()));
         $objRssItemNode = $objChannel->addChild("item");
         $objRssItemNode->addChild("title", "Something bad happened: \n" . $objException->getMessage() . "");
         $objRssItemNode->addChild("description", "Something bad happened: \n" . $objException->getMessage() . "");
         $objRssItemNode->addChild("pubDate", strftime("%a, %d %b %Y %H:%M:%S GMT", time()));
         $this->strOutput = $objFeedRootNode->asXML();
     }
 }
开发者ID:rcappuccio,项目名称:gitsvn,代码行数:31,代码来源:Svn2Rss.php


示例8: load

 public function load($inputFile)
 {
     $objects = array();
     if (!file_exists($inputFile)) {
         KalturaLog::err("input file " . $inputFile . " not found");
         exit(1);
     }
     $inputXml = file_get_contents($inputFile);
     $xml = new SimpleXMLElement($inputXml);
     foreach ($xml->children() as $searchableObject) {
         $objectAttribtues = $searchableObject->attributes();
         $objName = $objectAttribtues["name"];
         $this->parseObject("{$objName}", $objectAttribtues);
         $this->searchableIndices["{$objName}"] = array();
         foreach ($searchableObject->children() as $type => $searchableField) {
             switch ($type) {
                 case "field":
                     $this->parseField("{$objName}", $searchableField);
                     break;
                 case "index":
                     $this->parseIndex("{$objName}", $searchableField);
                     break;
             }
         }
         $objects[] = "{$objName}";
     }
     return $objects;
 }
开发者ID:visomar,项目名称:server,代码行数:28,代码来源:IndexObjectsGenerator.php


示例9: getImportantActs

function getImportantActs($xml_url, $xsl_filename, $n_nodes)
{
    try {
        // read the xml from url
        $xmldoc = new DomDocument();
        $xmldoc->load($xml_url);
        // read xslt file
        $xsldoc = new DomDocument();
        $xsldoc->load($xsl_filename);
        $xsl = new XSLTProcessor();
        $xsl->importStyleSheet($xsldoc);
        // trasforma XML secondo l'XSLT ed estrae il contenuto del div
        $transformed_xml = new SimpleXMLElement($xsl->transformToXML($xmldoc));
        $nodes = $transformed_xml->children();
        // write values to screen
        $cnt = 0;
        foreach ($nodes as $node) {
            $cnt++;
            $atto = OppAttoPeer::retrieveByPK($node['atto_id']);
            printf("\t%d. %s => %f\n", $cnt, $atto->getTitoloCompleto(), $node['totale']);
            if ($cnt >= $n_nodes) {
                break;
            }
        }
    } catch (Exception $e) {
        printf("Errore durante la scrittura del file: %s\n", $e->getMessage());
    }
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:28,代码来源:anno0Tasks.php


示例10: xmlpp

 /** Prettifies an XML string into a human-readable and indented work of art
  *  @param string $xml The XML as a string
  *  @param boolean $html_output True if the output should be escaped (for use in HTML)
  */
 public static function xmlpp($xml, $html_output = false)
 {
     $xml_obj = new SimpleXMLElement($xml);
     $level = 4;
     $indent = 0;
     // current indentation level
     $pretty = array();
     // get an array containing each XML element
     $xml = explode("\n", preg_replace('/>\\s*</', ">\n<", $xml_obj->asXML()));
     // shift off opening XML tag if present
     if (count($xml) && preg_match('/^<\\?\\s*xml/', $xml[0])) {
         $pretty[] = array_shift($xml);
     }
     foreach ($xml as $el) {
         if (preg_match('/^<([\\w])+[^>\\/]*>$/U', $el)) {
             // opening tag, increase indent
             $pretty[] = str_repeat(' ', $indent) . $el;
             $indent += $level;
         } else {
             if (preg_match('/^<\\/.+>$/', $el)) {
                 $indent -= $level;
                 // closing tag, decrease indent
             }
             if ($indent < 0) {
                 $indent += $level;
             }
             $pretty[] = str_repeat(' ', $indent) . $el;
         }
     }
     $xml = implode("\n", $pretty);
     return $html_output ? htmlentities($xml) : $xml;
 }
开发者ID:jmhobbs,项目名称:Twillip,代码行数:36,代码来源:twillip.php


示例11: _assocToXml

 /**
  * Function, that actually recursively transforms array to xml
  *
  * @param array $array
  * @param string $rootName
  * @param \SimpleXMLElement $xml
  * @return \SimpleXMLElement
  * @throws Exception
  */
 private function _assocToXml(array $array, $rootName, \SimpleXMLElement $xml)
 {
     $hasNumericKey = false;
     $hasStringKey = false;
     foreach ($array as $key => $value) {
         if (!is_array($value)) {
             if (is_string($key)) {
                 if ($key === $rootName) {
                     throw new Exception('Associative key must not be the same as its parent associative key.');
                 }
                 $hasStringKey = true;
                 $xml->addChild($key, $value);
             } elseif (is_int($key)) {
                 $hasNumericKey = true;
                 $xml->addChild($key, $value);
             }
         } else {
             $xml->addChild($key);
             self::_assocToXml($value, $key, $xml->{$key});
         }
     }
     if ($hasNumericKey && $hasStringKey) {
         throw new Exception('Associative and numeric keys must not be mixed at one level.');
     }
     return $xml;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:35,代码来源:ConvertArray.php


示例12: parseMaps

 private function parseMaps(\SimpleXMLElement $xml)
 {
     $maps = array();
     if (array_key_exists('maps', $this->mapping)) {
         foreach ($this->mapping['maps'] as $key => $item) {
             /* --- XML NS --- */
             if ('MobileRelatedApps' == $this->name) {
                 /** @var $element \SimpleXMLElement */
                 $element = $xml->{'RelatedApps'};
                 $ns = $xml->getNamespaces(true);
                 $map = array();
                 foreach ($element->children($ns['d2p1']) as $element) {
                     $map[(string) $element->{$item['xml']['key']}] = (string) $element->{$item['xml']['value']};
                 }
                 $maps[$key] = $map;
                 continue;
             }
             /* --- XML NS --- */
             $map = array();
             $parts = explode('.', $item['xml']['field']);
             $items = array();
             if (2 == count($parts)) {
                 $items = $xml->{$parts[0]}->{$parts[1]};
             }
             foreach ($items as $element) {
                 $map[(string) $element->{$item['xml']['key']}] = (string) $element->{$item['xml']['value']};
             }
             $maps[$key] = $map;
         }
     }
     return $maps;
 }
开发者ID:gerdlaser,项目名称:SimilarWebApi,代码行数:32,代码来源:XmlParser.php


示例13: sxml_show_info

/**
 * @param SimpleXMLElement $element
 */
function sxml_show_info(SimpleXMLElement $element)
{
    $isSingleElement = $element[0] == $element;
    $isListOfElements = $element[0] != $element and $element->attributes() !== NULL;
    printf("  Is single-element?   - %s\n", $isSingleElement ? 'Yes' : 'No');
    printf("  Is list-of-elements? - %s\n", $isListOfElements ? 'Yes' : 'No');
}
开发者ID:shambhukumar,项目名称:code,代码行数:10,代码来源:simple.php


示例14: buildXML

 /**
  * Build the XML for an issue
  * @param  array             $params for the new/updated issue data
  * @return \SimpleXMLElement
  */
 private function buildXML(array $params = array())
 {
     $xml = new \SimpleXMLElement('<?xml version="1.0"?><issue></issue>');
     foreach ($params as $k => $v) {
         if ('custom_fields' === $k && is_array($v)) {
             $custom_fields_item = $xml->addChild('custom_fields', '');
             $custom_fields_item->addAttribute('type', 'array');
             foreach ($v as $field) {
                 $item = $custom_fields_item->addChild('custom_field', '');
                 $item->addAttribute('id', (int) $field['id']);
                 $item->addChild('value', $field['value']);
             }
         } elseif ('watcher_user_ids' === $k && is_array($v)) {
             $watcher_user_ids = $xml->addChild('watcher_user_ids', '');
             $watcher_user_ids->addAttribute('type', 'array');
             foreach ($v as $watcher) {
                 $watcher_user_ids->addChild('watcher_user_id', (int) $watcher);
             }
         } elseif ('uploads' === $k && is_array($v)) {
             $uploads_item = $xml->addChild('uploads', '');
             $uploads_item->addAttribute('type', 'array');
             foreach ($v as $upload) {
                 $upload_item = $uploads_item->addChild('upload', '');
                 foreach ($upload as $upload_k => $upload_v) {
                     $upload_item->addChild($upload_k, $upload_v);
                 }
             }
         } else {
             $xml->addChild($k, $v);
         }
     }
     return $xml;
 }
开发者ID:iseth,项目名称:php-www,代码行数:38,代码来源:Issue.php


示例15: indexAction

 public function indexAction()
 {
     $url = $this->getRequest()->getParam('url');
     $xmlString = '<?xml version="1.0" standalone="yes"?><response></response>';
     $xml = new SimpleXMLElement($xmlString);
     if (strlen($url) < 1) {
         $xml->addChild('status', 'failed no url passed');
     } else {
         $shortid = $this->db->fetchCol("select * from urls where url = ?", $url);
         $config = Zend_Registry::getInstance();
         $sh = $config->get('configuration');
         if ($shortid[0]) {
             $hex = dechex($shortid[0]);
             $short = $sh->siteroot . $hex;
         } else {
             //if not insert then return the id
             $data = array('url' => $url, 'createdate' => date("Y-m-d h:i:s"), 'remoteip' => Pandamp_Lib_Formater::getRealIpAddr());
             $insert = $this->db->insert('urls', $data);
             $id = $this->db->lastInsertId('urls', 'id');
             $hex = dechex($id);
             $short = $sh->siteroot . $hex;
         }
         $xml->addChild('holurl', $short);
         $xml->addChild('status', 'success');
     }
     $out = $xml->asXML();
     //This returns the XML xmlreponse should be key value pairs
     $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($out);
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
 }
开发者ID:hukumonline,项目名称:zfurl,代码行数:31,代码来源:ApiController.php


示例16: toXml

 function toXml()
 {
     $baseStr = '<?xml version="1.0" standalone="yes"?><tree id="0"></tree>';
     $xml = new SimpleXMLElement($baseStr);
     $currentLevel = array($xml);
     $currentRgt = 0;
     foreach ($this->_tree as $key => $row) {
         if ($key == 0) {
             $currentLevel[0]->addAttribute('lft', $row['lft']);
             $currentLevel[0]->addAttribute('rgt', $row['rgt']);
             continue;
         } elseif ($row['lft'] > $currentLevel[count($currentLevel) - 1]->attributes()->rgt) {
             while ($row['lft'] > $currentLevel[count($currentLevel) - 1]->attributes()->rgt) {
                 array_pop($currentLevel);
             }
         }
         $node = $currentLevel[count($currentLevel) - 1]->addChild('item');
         $node->addAttribute('id', $row['enumerationId']);
         $node->addAttribute('text', $row['name']);
         $node->addAttribute('lft', $row['lft']);
         $node->addAttribute('rgt', $row['rgt']);
         if ($row['rgt'] > $row['lft'] + 1) {
             $node->addAttribute('child', 1);
             array_push($currentLevel, $node);
             $currentRgt = $row['rgt'];
         } elseif ($row['rgt'] + 1 == $currentRgt) {
             array_pop($currentLevel);
             $node->addAttribute('curRgt', $currentLevel[count($currentLevel) - 1]->attributes()->rgt);
         }
     }
     return $xml->asXml();
 }
开发者ID:lucianobenetti,项目名称:clearhealth,代码行数:32,代码来源:EnumerationsTree.php


示例17: xml_pretty_printer

/**
* Takes xml as a string and returns it nicely indented
*
* @param string $xml The xml to beautify
* @param boolean $html_output If the xml should be formatted for display on an html page
* @return string The beautified xml
*/
function xml_pretty_printer($xml, $html_output = FALSE)
{
    $xml_obj = new SimpleXMLElement($xml);
    $xml_lines = explode("n", $xml_obj->asXML());
    $indent_level = 0;
    $new_xml_lines = array();
    foreach ($xml_lines as $xml_line) {
        if (preg_match('#(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>.*<s*/s*[^>]+>)|(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?s*/s*>)#i', $xml_line)) {
            $new_line = str_pad('', $indent_level * 4) . $xml_line;
            $new_xml_lines[] = $new_line;
        } elseif (preg_match('#<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>#i', $xml_line)) {
            $new_line = str_pad('', $indent_level * 4) . $xml_line;
            $indent_level++;
            $new_xml_lines[] = $new_line;
        } elseif (preg_match('#<s*/s*[^>/]+>#i', $xml_line)) {
            $indent_level--;
            if (trim($new_xml_lines[sizeof($new_xml_lines) - 1]) == trim(str_replace("/", "", $xml_line))) {
                $new_xml_lines[sizeof($new_xml_lines) - 1] .= $xml_line;
            } else {
                $new_line = str_pad('', $indent_level * 4) . $xml_line;
                $new_xml_lines[] = $new_line;
            }
        } else {
            $new_line = str_pad('', $indent_level * 4) . $xml_line;
            $new_xml_lines[] = $new_line;
        }
    }
    $xml = join("n", $new_xml_lines);
    return $html_output ? '<pre>' . htmlentities($xml) . '</pre>' : $xml;
}
开发者ID:alex974,项目名称:prestashop-avalaratax,代码行数:37,代码来源:AvaTax.php


示例18: __construct

 public function __construct(\SimpleXMLElement $action_xml)
 {
     if ($action_xml == NULL) {
         throw new e\EmptyValueException("The xml cannot be empty.");
     }
     if (self::DEBUG && self::DUMP) {
         DebugUtility::dump(u\XMLUtility::replaceBrackets($action_xml->asXML()));
     }
     $this->action_xml = $action_xml;
     $action_attr = $action_xml->attributes();
     $this->identifier = $action_attr->identifier->__toString();
     if ($action_attr->label) {
         $this->label = $action_attr->label->__toString();
     }
     if ($action_attr->move) {
         $this->move = $action_attr->move->__toString();
     } else {
         $this->move = "";
     }
     if ($action_attr->{"next-id"}) {
         $this->next_id = $action_attr->{"next-id"}->__toString();
     } else {
         $this->next_id = "";
     }
     $this->triggers = array();
     if ($this->action_xml->trigger) {
         foreach ($this->action_xml->trigger as $trigger) {
             $this->triggers[] = new TriggerDefinition($trigger);
         }
     }
 }
开发者ID:quantegy,项目名称:php-cascade-ws-ns,代码行数:31,代码来源:ActionDefinition.class.php


示例19: _indeed

 public function _indeed()
 {
     $response = new stdClass();
     $response->complete = false;
     $response->isError = false;
     $request = Daq_Request::getInstance();
     $posted = $request->post("posted_within", 1);
     $country = $request->post("country", "US");
     $location = $request->post("location", "");
     $max = $request->post("max");
     $added = $request->post("added");
     $instance = Wpjb_Project::getInstance();
     $publisher = $instance->getConfig("indeed_publisher");
     $url = "http://api.indeed.com/ads/apisearch?publisher=";
     $url .= $publisher . "&co=" . $country . "&limit=";
     $url .= $max . "&l=" . urlencode($location) . "&fromage=" . $posted;
     $url .= "&q=" . urlencode($request->post("keyword", ""));
     $url .= "&v=2";
     $str = file_get_contents($url);
     $xml = new SimpleXMLElement($str);
     $found = intval($xml->totalresults);
     if ($found < $max) {
         $max = $found;
     }
     if (!$xml->xpath("//result")) {
         $response->complete = true;
         die(json_encode($response));
     }
     try {
         $all = $xml->xpath("//result");
         foreach ($xml->results->result as $r) {
             $keys[] = (string) $r->jobkey;
         }
         for ($i = 0; $i < count($keys); $i++) {
             if ($i != count($keys)) {
                 $key .= $keys[$i] . ",";
             } else {
                 $key .= $keys[$i];
             }
         }
         $url = "http://api.indeed.com/ads/apigetjobs?publisher={$publisher}&jobkeys=" . $key . "&v=2";
         $str = file_get_contents($url);
         $xml = new SimpleXMLElement($str);
         $all = $xml->xpath("//result");
         foreach ($xml->results->result as $r) {
             $added++;
             $response->added = $added;
             self::_insertIndeedJob($r);
         }
     } catch (Exception $e) {
         $response->error = $e->getMessage();
         $response->isError = true;
         die(json_encode($response));
     }
     if ($added >= $max) {
         $response->complete = true;
     }
     $response->max = $max;
     die(json_encode($response));
 }
开发者ID:robjcordes,项目名称:nexnewwp,代码行数:60,代码来源:CareerBuilder.php


示例20: export

 public function export(\SimpleXMLElement $blockNode)
 {
     $data = $blockNode->addChild('data');
     foreach ($this->getSelectedServices() as $link) {
         $data->addChild('service', $link->getHandle());
     }
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:7,代码来源:controller.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP SimpleXMLExtended类代码示例发布时间:2022-05-23
下一篇:
PHP SimpleWidget类代码示例发布时间: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