2017-02-07 6 views
0

클라이언트가 XML 형식의 제휴 피드를 구현하도록 요청했습니다. 그러나 파일은 650k 라인과 함께 거대합니다! simpleXML을 사용하여 구문 분석을 시도했지만 작동했지만 매우 느립니다. 결과적으로 웹 사이트가로드되지 않는 경우가 있습니다.큰 제휴 XML 피드 분석 사이트의 성능을

<?php 
$html = ""; 
$url = "http://www.digitick.com/rss/distributeur/fluxAffiliation195_815.xml"; 
$xml = simplexml_load_file($url); 

for($i = 0; $i < 10; $i++){ 
$title = $xml->content->eventList->event[$i]->eventName; 
$link = $xml->content->eventList->event[$i]->eventUrl; 
$description = $xml->content->eventList->event[$i]->eventPresentation; 
$dateStart = $xml->content->eventList->event[$i]->dateStart; 
$img = $xml->content->eventList->event[$i]->pictureUrl; 

$html .= "<a href='$link'><h3>$title</h3></a>"; 
$html .= "<img src=$img>"; 
$html .= "$description"; 
$html .= "<br />$dateStart<hr />"; 
} 
echo $html; 
?> 

나는 5am에 매일 아침 갱신이 동적 파일을 (처리하기 위해 할 수있는 일?

사전에 감사합니다!

답변

1

내가있는 SQLite는 데이터베이스 파일로 파일을 가져올 것 그런 다음 SQL을 사용하여 응용 프로그램에서 해당 부분을 요청하십시오. 대안으로 생성 된 출력을 캐시하고 하루에 한 번 큰 파일을 읽습니다.