This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mastodon_rss [2021/06/13 00:21] neil |
mastodon_rss [2021/06/14 20:16] (current) neil |
||
---|---|---|---|
Line 9: | Line 9: | ||
<?php | <?php | ||
header('Content-Type: text/xml'); | header('Content-Type: text/xml'); | ||
- | $bearer = "get your token from the development page in the mastodon web client settings"; | + | $bearer = "get your access token from the development page in the mastodon web client settings"; |
+ | $instance = "glasgow.social"; | ||
$headers = [ | $headers = [ | ||
'Authorization: Bearer '.$bearer, | 'Authorization: Bearer '.$bearer, | ||
Line 15: | Line 16: | ||
$ch_bookmarks = curl_init(); | $ch_bookmarks = curl_init(); | ||
- | curl_setopt($ch_bookmarks, CURLOPT_URL, "https://glasgow.social/api/v1/bookmarks"); | + | curl_setopt($ch_bookmarks, CURLOPT_URL, "https://$instance/api/v1/bookmarks"); |
curl_setopt($ch_bookmarks, CURLOPT_RETURNTRANSFER, true); | curl_setopt($ch_bookmarks, CURLOPT_RETURNTRANSFER, true); | ||
curl_setopt($ch_bookmarks, CURLOPT_HTTPHEADER, $headers); | curl_setopt($ch_bookmarks, CURLOPT_HTTPHEADER, $headers); | ||
Line 39: | Line 40: | ||
foreach($bookmarks as $k=>$v) { | foreach($bookmarks as $k=>$v) { | ||
- | //echo $v['url']."\n"; | ||
- | //echo $v['content']."\n"; | ||
$xml_item[$k] = "\n\t<item> | $xml_item[$k] = "\n\t<item> | ||
<title>{$v['card']['title']}</title> | <title>{$v['card']['title']}</title> |