1 | <?php
|
---|
2 |
|
---|
3 | class MeetSourceFacebook extends MeetSource
|
---|
4 | {
|
---|
5 | function Import(): string
|
---|
6 | {
|
---|
7 | return '';
|
---|
8 | $Output = parent::Import();
|
---|
9 | $Content = file_get_contents($this->URL);
|
---|
10 | echo($Content);
|
---|
11 |
|
---|
12 | $BlockStart = 'id="newsFeedHeading">Vybrané příspěvky</h2>';
|
---|
13 | $BlockEnd = '</code></div>';
|
---|
14 | $Content = GetTextBetween($Content, $BlockStart, $BlockEnd);
|
---|
15 | if ($Content == '')
|
---|
16 | {
|
---|
17 | $Output .= 'Main block not isolated.</br>';
|
---|
18 | return $Output;
|
---|
19 | }
|
---|
20 |
|
---|
21 | $ItemStart = 'fbfeed_location';
|
---|
22 | $ItemEnd = '</form></div></div></div></div>';
|
---|
23 | while (strpos($Content, $ItemStart) !== false)
|
---|
24 | {
|
---|
25 | $Item = GetTextBetween($Content, $ItemStart, $ItemEnd);
|
---|
26 | echo($Item);
|
---|
27 | $MeetItem = new MeetItem();
|
---|
28 |
|
---|
29 | $MeetItem->Gender = trim(html_entity_decode(GetTextBetween($Item, 'class="kategorie">', '<div')));
|
---|
30 | if ($MeetItem->Gender == 'Hledám partnera') $MeetItem->Gender = Gender::Female;
|
---|
31 | else if ($MeetItem->Gender == 'Hledám partnerku') $MeetItem->Gender = Gender::Male;
|
---|
32 | else $MeetItem->Gender = Gender::Undefined;
|
---|
33 | $MeetItem->Name = trim(html_entity_decode(GetTextBetween($Item, '<span class="_39_n">', '</span>')));
|
---|
34 | $MeetItem->Time = trim(GetTextBetween($Item, ' ', '</th>'));
|
---|
35 | $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time);
|
---|
36 | $MeetItem->Height = trim(GetTextBetween($Item, "výška:", 'cm'));
|
---|
37 | $MeetItem->Message = trim(html_entity_decode(strip_tags(GetTextBetween($Item, 'data-ft="{"tn":"K"}">', '</div>'))));
|
---|
38 | $MeetItem->Age = GetAgeFromText($MeetItem->Message);
|
---|
39 | $MeetItem->Height = GetHeightFromText($MeetItem->Message);
|
---|
40 | $MeetItem->Weight = GetWeightFromText($MeetItem->Message);
|
---|
41 | $MeetItem->Location = GetLocationFromText($MeetItem->Message);
|
---|
42 | $MeetItem->Email = trim(GetTextBetween($Item, '<strong>', '</strong>'));
|
---|
43 | $MeetItem->Phone = trim(html_entity_decode(strip_tags(GetTextBetween($Item, 'Telefon:', '</td>'))));
|
---|
44 | if ($MeetItem->Phone == 'neuveden') $MeetItem->Phone = '';
|
---|
45 | $MeetItem->Link = '';
|
---|
46 | print_r($MeetItem);
|
---|
47 | die();
|
---|
48 | $MeetItem->Database = $this->Database;
|
---|
49 | $MeetItem->Source = $this->Id;
|
---|
50 | $this->MeetItems[] = $MeetItem;
|
---|
51 | }
|
---|
52 | return $Output;
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|