? < PHP header ( 'Content-Type: text / HTML; charset = UTF-8' ); // 1. get xml data $ XMLData = file_get_contents ( "HTTP: // URL API" ); // 2. xml is converted to the object simplexml // $ simplexml_load_string XMLString = ($ XMLData); $ XMLString = simplexml_load_string ( $ XMLData , 'the SimpleXMLElement', LIBXML_NOCDATA); // 3. the object is converted into json simplexml, then json into an array. value_array $ = of json_decode (json_encode ( $ XMLString ), to true ); // print_r ($ value_array); // Die (); $ Result =$value_array['row']; //期号 $expect = $result['@attributes']['expect']; //号码 $opencode = $result['@attributes']['opencode']; //时间 $opentime = $result['@attributes']['opentime']; //print_r($expect."-".$opencode."-".$opentime); //die(); ?>