yoneda
12/11/2017 - 1:28 PM

scrapbox.php

<?php

date_default_timezone_set('Asia/Tokyo');
$url = "https://scrapbox.io/api/pages/yoneda/?limit=3";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$results = curl_exec($curl);
curl_close($curl);

$decodedResults = json_decode($results);
$pages = $decodedResults->pages;
for($i=0; $i<count($pages); $i++){
  $title = $pages[$i]->title;
  $datetime = date("Y-m-d",$pages[$i]->created);
  print($title."\n");
  print($datetime."\n");
}

?>