Tag: cal for simple ret fopen tar var time one
$txt= Getremotetext ($url);if(strlen($txt) > 0){ $xml=simplexml_load_string($txt);//Get XML if($xml) { $logo=$xml->xpath ("Webinfo"); $title=$xml->xpath ("title"); $keywords=$xml->xpath ("keywords"); $description=$xml->xpath ("description"); $ret. = "var Wg_logo = \" ".$logo[0] ["logo"]. "\" \ r \ n "; $ret. = "var wg_title = \" ".$title[0] ["title"]. "\" \ r \ n "; $ret. = "var wg_keywords = \" ".$keywords[0] ["keywords"]. "\" \ r \ n "; $ret. = "var wg_description = \" ".$description[0] ["description"]. "\" \ r \ n "; $group _info= "\r\nvar Group_info = [\ r \ n]; $district _info= "\r\nvar District_info = [\ r \ n]; foreach($xml->children () as $child) { if("gamelist" = =$child-GetName ()) { //Group Information foreach($child->children () as $groupChild) { $group _info. = "['".$groupChild["id"]. "‘,‘" .$groupChild["Gamename"]. "'],\r\n"; } } Else if("zonelist" = =$child-GetName ()) { //Partition Information foreach($child->children () as $districtChild) { $district _info. = "['".$districtChild["id"]. "‘,‘" .$districtChild["ZoneName"] . "‘,‘" .$districtChild["StartTime"]. "‘,‘" .$districtChild["GameID"]. "'],\r\n"; } } } $group _info. = "];\r\n"; $district _info. = "];\r\n"; $ret.=$group _info.$district _info; $file=fopen($localJsPath, "W"); fwrite($file,$ret); fclose($file); }}
$xml->xpath ("Webinfo")[0]["logo"] some PHP compiler does not pass
PHP SimpleXML Example