如何使用php过滤从xml转换为php对象的数据?

时间:2018-01-16 13:07:06

标签: php xml jquery-selectbox

如何在html选择框中显示数组,我想过滤具有不同参数的过滤器中的数据。

$xml_feed_url = 'http://www.propertyfinder.ae/upload/xmlfeed/xml-feed-
example.xml';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $xml_feed_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
curl_close($ch);   



function produce_XML_object_tree($raw_XML) {
   libxml_use_internal_errors(true);
     try {
       $xmlTree = new SimpleXMLElement($raw_XML);
     } catch (Exception $e) {
    // Something went wrong.
       $error_message = 'SimpleXMLElement threw an exception.';
         foreach(libxml_get_errors() as $error_line) {
        $error_message .= "\t" . $error_line->message;
        }
        trigger_error($error_message);
        return false;
      }
   return $xmlTree;
 }
 $feed = produce_XML_object_tree($xml);

0 个答案:

没有答案