function write_ini_file($inifilename, $mode = null, $key, $value) { ini_file($inifilename, $mode, $key, $value); }
break; } } } #print_r($re_list); #获取token $token = file_get_contents('token.txt'); $appid = APPID; foreach ($re_list as $k => $v) { $news_id = $v['id']; //检查Ini文件是否存在 ##存在就跳过,写入 $cur_date = date('Y-m-d'); $is_have = ini_file(null, 'default', $news_id); if ('' == $is_have) { ini_file(null, 'default', $news_id, $cur_date); } else { continue; } #$news_id = 'urn:newsml:reuters.com:20160105:nL3T14P02B'; $tmp_content = get_news_content($appid, $token, $news_id); file_put_contents("./data/news/content.xml", $tmp_content); #获取HT-标题 # TE-内容 #$format_content = XML_unserialize($tmp_content); #print_r($format_content); /*$title = $format_content['s:Envelope']['s:Body']['ns0:RetrieveStoryML_Response_1']['ns0:StoryMLResponse']['ns0:STORYML']['HL']['HT']; $content = $format_content['s:Envelope']['s:Body']['ns0:RetrieveStoryML_Response_1']['ns0:StoryMLResponse']['ns0:STORYML']['HL']['TE']; $re_list[$k]['title'] = $title; $re_list[$k]['content'] = htmlspecialchars($content);*/ $tmp_content_url = "./data/news/content.xml";