if (!isset($_REQUEST["u"])){
$u = "dansku";
}
else {
$u = $_REQUEST["u"];
$myFile = "users.txt";
$fh = fopen($myFile, 'w');
$stringData = $u . "\n";
fwrite($fh, $stringData);
fclose($fh);
}
$imagelimit = 2000;
function curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
return curl_exec($ch);
curl_close($ch);
}
$jsonurl = 'https://api.picplz.com/api/v2/user.json?include_pics=1&pic_page_size=' . $imagelimit . '&username=' . $u . '&include_geo=1';
$json = curl($jsonurl);
//$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json,true);
$size = sizeof($json_output['value']['users'][0]['pics']);
$username = $json_output['value']['users'][0]['pics'][0]['creator']['username'];
echo 'Here you have ' . $username . '\'s photos from PicPlz
';
//echo 'Click here to create your own
';
/*
echo $json_output['value']['users'][0]['pics'][0]['pic_files']['100sh']['img_url'];
echo $jsonurl;
echo "";
print_r($json_output);
echo "
";
*/
echo '';
echo '
';
for($i=0;$i<$size;$i++) {
$url = $json_output['value']['users'][0]['pics'][$i]['pic_files']['100sh']['img_url']; // Imagem Pequena
$urlbg = $json_output['value']['users'][0]['pics'][$i]['pic_files']['640r']['img_url']; // Imagem Grande
$view_count = $json_output['value']['users'][0]['pics'][$i]['view_count'];
$img_id = $json_output['value']['users'][0]['pics'][$i]['id'];
$caption = $json_output['value']['users'][0]['pics'][$i]['caption'];
$seguranca = ord($caption);
if($caption == "") { $caption = " ";}
else { $caption = "[ ". $caption ." ] -";}
$caption=str_replace("'"," ",$caption); //Arruma ' e " em captions
$caption=str_replace("\""," ",$caption);
$like_count = $json_output['value']['users'][0]['pics'][$i]['like_count'];
$date = $json_output['value']['users'][0]['pics'][$i]['date'];
$date = date("d/m/y",$date);
$lat = $json_output['value']['users'][0]['pics'][$i]['location']['lat'];
$long = $json_output['value']['users'][0]['pics'][$i]['location']['lon'];
if($seguranca == 35){
echo " ";
}
else {
echo " ";
}
}
echo '
';
echo '
';
// Fotos por página = 20
$numpages = $size / 20;
//
//echo $numpages;
//for($j=0;$j<$numpages;$j++){ echo " ".$j." - "; }
//echo "Imagens: ".$size;
?>