문제

I'm currently working on a new backpacker trip portal. My idea is to load specific trip warnings from the official governement site on my site. I am allowed to use their official information due to german laws. But the point is, that they change their content on a daily to hourly basis, so copy & paste is no solution. I already tried getting their content via jQuery, but cross-domain-policy came across and as you can imagine I have no control over their server ;-) While searching for a solution I came across cURL in PHP. From here on I need your help, because I can only wright some few small functions. I thought maybe there is an option to fetch the content via cURL and then just display the divs I need or to use their rss feed and fetch the information from there? Any help or hints are appreciated :-)

Website: http://www.auswaertiges-amt.de/DE/Laenderinformationen/WeitereAktuelleReiseInformationen_node.html xml-based rss feed: http://www.auswaertiges-amt.de/SiteGlobals/Functions/RSSFeed/DE/RSSNewsfeed/RSS_Reisehinweise.xml?nn=332604

도움이 되었습니까?

해결책

HTML Solution Simple html Dom is a library that permit use select DOM tag type jquery,

use like as

$html=file_get_html('http://www.auswaertigesamt.de/DE/Laenderinformationen/WeitereAktuelleReiseInormationen_node.html');

$note_text = $html->find("div[class=reiseUebersicht]", 0)->children(1)->plaintext;

I guess that HTML is a easy solution because your RSS(xml) is unlike a standard because it embed html , like as "<![CDATA[ ]]>"

Parse XML Solution use PHP Simple DOM, but you need parse HML DOM , for decode cdata

$doc = DOMDocument::load('http://www.example.com/file.xml');

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top