Created
March 11, 2015 19:31
-
-
Save bytepicker/1e4a008eddb366aa9d4c 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 | |
$url = 'https://api.vk.com/method/wall.get?owner_id=183123381&count=1&filter="owner"'; | |
$jsonFile = file_get_contents($url); | |
// convert the string to a json object | |
$jfo = json_decode($jsonFile, true); | |
$textWall = $jfo['response'][1]['text']; | |
// get number of poems | |
$numCount = $jfo['response'][0]; | |
$randOffset = rand(1,$numCount-1); | |
// now get random poem | |
$bydloCod = "&offset=" . $randOffset; | |
$urlRand = $url . $bydloCod; | |
$jsonFileRand = file_get_contents($urlRand); | |
$jfoRand = json_decode($jsonFileRand, true); | |
$textWallRand = $jfoRand['response'][1]['text']; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment