function &XML_unserialize(&$xml) { $xml_parser = new XmlParse(); $data =& $xml_parser->parse($xml); $xml_parser->destruct(); return $data; }
/** * 反序列化XML * @param string $xml * @return array * @static */ function &unserializeXml($string) { $xml_parser = new XmlParse(); $data =& $xml_parser->parse(&$string); $xml_parser->destruct(); return $data; }
<?php require_once '../util/feedUtils.php'; require_once '../util/templetParse.php'; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ $cookie_file = "taobao"; $login_action = "http://login.taobao.com/member/login.jhtml"; $data = array("actionForStable" => "enable_post_user_action", "action" => "Authenticator", "TPL_username" => "xxx", "TPL_password" => "xxx", "loginType" => "3", "CtrlVersion" => "1,0,0,7", "tid" => "tid", "support" => "000001", "mi_uid" => "", "mcheck" => "", "TPL_redirect_url" => "www.taobao.com", "event_submit_do_login" => "anything", "_oooo_" => ""); getHtml($login_action, $data, null, $cookie_file); $url = "http://item.taobao.com/auction/item_detail.htm?xid=0db2&item_num_id=2255050794&cm_cat=50015927&pm2=1&source=dou"; $item_page = getHtml($url, null, null, $cookie_file); $xml = XmlParse::html2Xml("../xslt/taobao.xsl", $item_page, false); $sxml = simplexml_load_string($xml); $favorite_pop = getHtml($sxml, null, null, $cookie_file); //$strSrc=array(" ","°","’","©",'á','é','í','ó','ú','ñ'); //$strDes=array(" ","","'","","a","e","i","o","u","n"); $html = cleanHtml($favorite_pop, true); $html = "<body>" . $html . "</body>"; $xml = new DOMDocument(); $xml->loadHTML($html); $sxml = simplexml_import_dom($xml); $entry = $sxml->xpath("//form[@id='PopupFavorForm']/script[2]/@src"); $hide_input1 = getHtml($entry[0]->src, null, null, $cookie_file); $input1 = split("document.write", $hide_input1); $add_param = array("tags" => "psp", "isShared" => true, "shopIncluded" => false); foreach ($input1 as $input) { $strSrc = array("('<input", ">');"); $strDes = array("", "");