Created
December 11, 2017 13:28
-
-
Save yoneda/e557b8e099a2dae8f10f7e380d13fe26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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