Advertisement
hd1

bookmarks.php

hd1
Oct 24th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <meta charset="utf-8">
  3. <html>
  4.     <head>
  5.         <title>Shared Links</title>
  6.     </head>
  7.     <body>
  8.         <table>
  9.         <thead>
  10. <?php
  11. $req = curl_init();
  12. curl_setopt($req, CURLOPT_URL, "http://hasan.d8u.us/links.py.cgi?format=csv");
  13. curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
  14. $to_parse = curl_exec($req);
  15. $parsed_lines = str_getcsv($to_parse, "\n");
  16. $header = str_getcsv($parsed_lines[0], ",");
  17. echo "<tr><th>".$header[0]."</th><th>".$header[1]."</th><th>".$header[2]."</th></tr>";
  18. ?>
  19.             </thead><tbody>
  20. <?php
  21. for ($i = count($parsed_lines)-1;$i != 0; $i--) {
  22.     $row = str_getcsv($parsed_lines[$i]);
  23.     $time_ = new DateTime();
  24.     $time_ -> setTimestamp($row[2]);
  25.     $time = $time_->format('Y-m-d\TH:i:s');
  26.     $link = "<a href=\"".$row[1]."\">"."Go to link"."</a>";
  27.     print("<tr><td>$row[0]</td><td>$link</td><td>$time</td></tr>");
  28. }
  29. ?>
  30.             </tbody>
  31.         </table>
  32.     </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement