-
Notifications
You must be signed in to change notification settings - Fork 0
/
recent.php.html
4 lines (4 loc) · 3.21 KB
/
recent.php.html
1
2
3
4
<code><span style="color: #000000">
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #007700">require_once </span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">) . </span><span style="color: #DD0000">'/../helper.php'</span><span style="color: #007700">;<br />require_once </span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">) . </span><span style="color: #DD0000">'/../spyc/spyc.php5'</span><span style="color: #007700">;<br />require_once </span><span style="color: #DD0000">'Zend/Service/Delicious.php'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// create a new Delicious client instance<br /></span><span style="color: #0000BB">$delicious </span><span style="color: #007700">= new </span><span style="color: #0000BB">Zend_Service_Delicious</span><span style="color: #007700">(</span><span style="color: #0000BB">DELICIOUS_USERNAME</span><span style="color: #007700">, </span><span style="color: #0000BB">DELICIOUS_PASSWORD</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// fetch all recent posts<br /></span><span style="color: #0000BB">$posts </span><span style="color: #007700">= </span><span style="color: #0000BB">$delicious</span><span style="color: #007700">-></span><span style="color: #0000BB">getRecentPosts</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #DD0000">"Found " </span><span style="color: #007700">. </span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$posts</span><span style="color: #007700">) . </span><span style="color: #DD0000">" post(s)\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// loop over all $posts<br /></span><span style="color: #007700">foreach (</span><span style="color: #0000BB">$posts </span><span style="color: #007700">as </span><span style="color: #0000BB">$index </span><span style="color: #007700">=> </span><span style="color: #0000BB">$post</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"$index.\n"</span><span style="color: #007700">;<br /> echo </span><span style="color: #DD0000">" Title: {$post->getTitle()}\n"</span><span style="color: #007700">;<br /> echo </span><span style="color: #DD0000">" Url: {$post->getUrl()}\n"</span><span style="color: #007700">;<br /> echo </span><span style="color: #DD0000">" Desc: {$post->getNotes()}\n"</span><span style="color: #007700">;<br />}<br /></span>
</span>
</code>