M
M
Maxim Grushko2015-10-21 03:31:26
PHP
Maxim Grushko, 2015-10-21 03:31:26

How to parse a site through an rss feed into a file?

Good night,
knowledgeable people, tell me how to use simple_html_dom.php with
www.hltv.org/hltv.rss.php
to parse links from this feed, namely:
1-names of teams playing each other
2-team logos
3-match start time
4-name of the tournament
5-list of maps (most often known 5-30 minutes before the start of the game)
6-game format (best of 1, best of 2, etc.)
7-match score if the game is over
8-commands of teams
9- player photos
10-player flags
c5fdbbd697dd464b88b4a798c9a9ee8d.png
Parse everything into some file like xml or the like.
drew attention to the question here
Can't parse correctly with PHP Simple Dom Parser?
and maybe on the parser herehttps://github.com/KenanY/hltv-match/blob/master/i...

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexander Taratin, 2015-10-21
@Taraflex

Use the https://github.com/olamedia/nokogiri library , everything will be easier with it.

A
Alexey Ostin, 2015-10-21
@nitso

Rss contains only the following data: title (title, 2 teams), link (link), description (tournament), pubDate (date). Therefore, only them can be pulled out from there.

$html = file_get_html('www.hltv.org/hltv.rss.php');
foreach($html->find('item') as $element) 
       $title =  $element->find('title', 0)->plaintext;
       $link =  $element->find('link', 0)->plaintext;
       $description =  $element->find('description' , 0)->plaintext;
       $pubDate =  $element->find('pubDate', 0)->plaintext;
}

V
Vladislav Gaiduk, 2015-10-21
@Danan

vk.com/dockgg write me, I will help

A
Aleksey Ratnikov, 2015-10-21
@mahoho

I recommend using XSLT for parsing html - it's the fastest way in terms of performance. Templates, of course, are cumbersome, but these are trifles, and slow heavy third-party libraries are not needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question