Skip to content

Instantly share code, notes, and snippets.

@yoneda
Created December 11, 2017 13:28
Show Gist options
  • Save yoneda/e557b8e099a2dae8f10f7e380d13fe26 to your computer and use it in GitHub Desktop.
Save yoneda/e557b8e099a2dae8f10f7e380d13fe26 to your computer and use it in GitHub Desktop.
<?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");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment