-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.php
More file actions
99 lines (87 loc) · 3.19 KB
/
Copy pathcore.php
File metadata and controls
99 lines (87 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
require 'jdf.php';
function XMLrender($streams) {
$data = [];
$timestamps = [];
foreach($streams as $owner => $stream) {
$stream = file_get_contents($stream);
$parser = simplexml_load_string($stream);
foreach ($parser->channel->item as $item) {
$date = (string )$item->pubDate;
// echo "$date\r\n";
$time = strtotime($item->pubDate);
// echo "$time\r\n";
$link = (string) $item->link;
// echo "$link\r\n";
$title = (string) $item->title;
// echo "$title\r\n";
$text = (string) $item->description;
// echo "<hr>";
$data[] = [
'src' => $owner,
'timestamp' => $time,
'url' => $link,
'title' => $title
];
$timestamps[$time] = [
'src' => $owner,
'timestamp' => $time,
'url' => $link,
'title' => $title
];
}
}
krsort($timestamps);
return $timestamps;
};
function FileXMLrender ($streams) {
header('Content-type: text/html; charset=utf-8');
mb_internal_encoding('UTF-8');
$data = [];
$timestamps = [];
foreach($streams as $owner => $stream) {
$stream = file_get_contents($stream);
$handle= fopen("stream.txt", "w");
fwrite($handle, $stream);
$parser = simplexml_load_file($stream);
foreach ($parser->channel->item as $item) {
$date = (string )$item->pubDate;
// echo "$date\r\n";
$time = strtotime($item->pubDate);
// echo "$time\r\n";
$link = (string) $item->link;
// echo "$link\r\n";
$title = (string) $item->title;
// echo "$title\r\n";
$text = (string) $item->description;
// echo "<hr>";
$data[] = [
'src' => $owner,
'timestamp' => $time,
'url' => $link,
'title' => $title
];
$timestamps[$time] = [
'src' => $owner,
'timestamp' => $time,
'url' => $link,
'title' => $title
];
}
}
}
$op = XMLrender([
'گسترشنیوز' => 'https://www.gostaresh.news/fa/feeds/?p=Y2F0ZWdvcmllcz04Mw%2C%2C',
'اقتصاد آنلاین' => 'https://www.eghtesadonline.com/fa/feeds/?p=Y2F0ZWdvcmllcz0xMA%2C%2C',
'اقتصاد نیوز' => 'https://www.eghtesadnews.com/fa/feeds/?p=Y2F0ZWdvcmllcz02Nw%2C%2C',
'تسنیم' => 'https://www.tasnimnews.com/fa/rss/feed/0/7/7/%D8%A7%D9%82%D8%AA%D8%B5%D8%A7%D8%AF%DB%8C',
'مشرق' => 'https://www.mashreghnews.ir/rss/tp/16',
'پندار آنلاین' => 'https://www.pendaronline.news/fa/feeds/?p=Y2F0ZWdvcmllcz00'
]);
// $op = FileXMLrender([
// // 'gostaresh.news' => 'https://www.gostaresh.news/fa/feeds/?p=Y2F0ZWdvcmllcz04Mw%2C%2C',
// // 'rokna.net' => 'https://www.rokna.net/fa/feeds/?p=Y2F0ZWdvcmllcz02NQ%2C%2C',
// // 'yjc.ir' => 'https://www.yjc.ir/fa/rss/5/18'
// ]);
// echo '<pre>';
// print_r($op);