... | ... |
@@ -4,15 +4,15 @@ $NEWS_RSS_MAX_ITEMS = 10; |
4 | 4 |
|
5 | 5 |
function DOMinnerHTML(DOMNode $element) |
6 | 6 |
{ |
7 |
- $innerHTML = ""; |
|
8 |
- $children = $element->childNodes; |
|
7 |
+ $innerHTML = ""; |
|
8 |
+ $children = $element->childNodes; |
|
9 | 9 |
|
10 |
- foreach ($children as $child) |
|
11 |
- { |
|
12 |
- $innerHTML .= $element->ownerDocument->saveHTML($child); |
|
13 |
- } |
|
10 |
+ foreach ($children as $child) |
|
11 |
+ { |
|
12 |
+ $innerHTML .= $element->ownerDocument->saveHTML($child); |
|
13 |
+ } |
|
14 | 14 |
|
15 |
- return $innerHTML; |
|
15 |
+ return $innerHTML; |
|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
function http_get_contents($url, $opts = []) |
... | ... |
@@ -36,12 +36,17 @@ function http_get_contents($url, $opts = []) |
36 | 36 |
} |
37 | 37 |
|
38 | 38 |
function re_remove($source, $regex) { |
39 |
- return preg_replace($regex, '', $source); |
|
39 |
+ return preg_replace($regex, '', $source); |
|
40 | 40 |
} |
41 | 41 |
|
42 | 42 |
function add_https($source, $seed) { |
43 |
- $orgStrings = array( "http://$seed/" ); |
|
44 |
- $newStrings = array( "https://$seed/" ); |
|
45 |
- return str_replace($orgStrings, $newStrings, $source); |
|
43 |
+ $orgStrings = array( "http://$seed/" ); |
|
44 |
+ $newStrings = array( "https://$seed/" ); |
|
45 |
+ return str_replace($orgStrings, $newStrings, $source); |
|
46 |
+} |
|
47 |
+ |
|
48 |
+function dump2file($prefix, $index, $content) { |
|
49 |
+ $filename = "dump-".$prefix."-".$index.".html"; |
|
50 |
+ file_put_contents($filename,$content); |
|
46 | 51 |
} |
47 | 52 |
?> |