Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F8321439
notesofberlin.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
notesofberlin.php
View Options
<?php
//Configuration
error_reporting
(
E_ERROR
|
E_WARNING
|
E_PARSE
);
//magpierss isn't strict compliant
//Libraries
require
(
'magpierss/rss_fetch.inc'
);
require
(
'xmlwriter/xmlwriterclass.php'
);
require
(
'rsswriter/rss_writer_class.php'
);
//Helper functions
function
get_description
(
$item
)
{
$post
=
file_get_contents
(
$item
[
'link'
]);
$data
=
string_between
(
$post
,
"<div class='post-body entry-content'>"
,
"</table>"
);
$data
=
string_between
(
$data
,
"<img "
,
"/>"
,
true
,
true
);
return
$data
?
"<p>$item[summary]</p><p>$data</p>"
:
$item
[
'summary'
];
}
//Source RSS
$source_rss
=
fetch_rss
(
"http://www.notesofberlin.com/feeds/posts/default"
);
//Our RSS
$rss
=
new
rss_writer_class
();
$rss
->
about
=
'http://tools.nasqueron.org/rss/notesofberlin.php'
;
$rss
->
generatedcomment
=
'Generated by: Magpie RSS, rsswriter, Nasqueron tools.'
;
$rss
->
rssnamespaces
[
'dc'
]
=
'http://purl.org/dc/elements/1.1/'
;
//Channel
$properties
=
[
'description'
=>
$source_rss
->
channel
[
'subtitle'
],
'link'
=>
'http://www.notesofberlin.com/'
,
'title'
=>
'Notes of Berlin'
,
'dc:date'
=>
$source_rss
->
channel
[
'updated'
],
//'author' => $source_rss->channel['author_email'],
];
$rss
->
addchannel
(
$properties
);
//Items
foreach
(
$source_rss
->
items
as
$item
)
{
$properties
=
[
'description'
=>
get_description
(
$item
),
];
//$properties_to_copy = ['id', 'published', 'updated', 'title', 'link'];
$properties_to_copy
=
[
'title'
,
'link'
];
foreach
(
$properties_to_copy
as
$property
)
{
$properties
[
$property
]
=
$item
[
$property
];
}
$rss
->
additem
(
$properties
);
}
//Output
$output
=
''
;
if
(
$rss
->
writerss
(
$output
))
{
header
(
'Content-Type: text/xml; charset="'
.
$rss
->
outputencoding
.
'"'
);
header
(
'Content-Length: '
.
strval
(
strlen
(
$output
)
+
3
));
echo
$output
;
}
else
{
message_die
(
GENERAL_ERROR
,
$rss
->
error
,
'RSS generation error'
);
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 16:43 (12 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2582428
Default Alt Text
notesofberlin.php (1 KB)
Attached To
Mode
rTOOLS Nasqueron Tools
Attached
Detach File
Event Timeline
Log In to Comment