Ejemplo n.º 1
0
 public static function FetchGoogleJSON($url)
 {
     $response = file_get_contents($url);
     $response = GoogleUtil::CleanGoogleJSON($response);
     usleep(20000);
     //be nice. let's sleep for 20ms
     return json_decode($response, true);
 }
Ejemplo n.º 2
0
 public static function FetchActivityStream($googleplus_id)
 {
     $activity_url = 'https://plus.google.com/_/stream/getactivities/' . $googleplus_id . '/?sp=%5B1%2C2%2C%22' . $googleplus_id . '%22%2Cnull%2Cnull%2Cnull%2Cnull%2C%22social.google.com%22%2C%5B%5D%5D';
     $jsondata = GoogleUtil::FetchGoogleJSON($activity_url);
     $activities = $jsondata[1][0];
     //var_dump( $jsondata );
     $posts = array();
     foreach ($activities as $postdata) {
         $post = new PlusPost();
         $post->loadFromGooglePlusJSON($postdata);
         $posts[] = $post;
     }
     return $posts;
 }
Ejemplo n.º 3
0
 public static function FetchIncomingPlusPeople($plusid)
 {
     $people = array();
     if ($plusid != "") {
         //echo "fetch followers<br/>";
         $visible_url = 'https://plus.google.com/_/socialgraph/lookup/incoming/?o=%5Bnull%2Cnull%2C%22' . $plusid . '%22%5D&n=1000';
         $jsondata = GoogleUtil::FetchGoogleJSON($visible_url);
         $inpeople = $jsondata[2];
         foreach ($inpeople as $pdata) {
             $person = new PlusPerson();
             $person->googleplus_id = $pdata[0][2];
             $name = $pdata[2][0];
             if (preg_match('/^([\\w\\.\\s]+) (\\w+)$/', $name, $matches)) {
                 $person->first_name = $matches[1];
                 $person->last_name = $matches[2];
             } else {
                 $person->first_name = $name;
             }
             $people[] = $person;
         }
     }
     return $people;
 }
Ejemplo n.º 4
0
 public static function FetchGoogleJSON($url)
 {
     $response = file_get_contents($url);
     $response = GoogleUtil::CleanGoogleJSON($response);
     return json_decode($response, true);
 }