3 // $a = array('name' => 'my name with & and /' );
4 // echo json_encode($a);
5 // echo "{ name: 'pippopluto' }";
7 // http://www.alternativeoutput.it/briskblog/doku.php?id=utenti:social&do=edit
9 // footer: ===== Per essere aggiunto =====
10 // |mop|[[https://www.facebook.com/bi.cci.5|bi.cci.5]]|
12 function retrieve_login($userid)
14 $cache_file = '/var/www/webspace/brisk-priv/brisk-fb-whois.cache';
15 // $cache_file = '/tmp/brisk-fb-whois.cache';
16 $cache_max_age = 3600;
18 $page_name = 'http://www.alternativeoutput.it/briskblog/doku.php?id=utenti:social&do=edit';
19 $userid_pfx = 'https://www.facebook.com/';
24 if (!file_exists($cache_file) || ($curtime - filemtime($cache_file)) > $cache_max_age) {
25 if (($content = file_get_contents($page_name)) == FALSE) {
26 echo json_encode(array('name' => 'problemi sul server', 'is_cache' => $is_cache, 'err' => 2));
29 file_put_contents($cache_file, $content);
33 if (($content = file_get_contents($cache_file)) == FALSE) {
34 echo json_encode(array('name' => 'problemi sul server', 'is_cache' => $is_cache, 'err' => 2));
39 $content_ar = explode("\n", $content);
41 foreach($content_ar as $key => $value) {
44 if (substr($value, 0, 8) == '^ A ^^') {
50 if (substr($value, 0, 31) == '===== Per essere aggiunto =====') {
54 if (strstr($value, $userid_pfx.$userid.'|')) {
55 $ret_ar = explode('|', $value);
56 echo json_encode(array('name' => $ret_ar[1], 'is_cache' => $is_cache, 'err' => 0));
62 echo json_encode(array('name' => 'utente non trovato', 'is_cache' => $is_cache, 'err' => 1));
69 retrieve_login($userid);