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; }
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; }
public function getFriends() { if ($this->_friends == null) { $this->_friends = array(); $this->_friend_ids = array(); if ($this->_id_social != "") { $visible_url = 'https://plus.google.com/_/socialgraph/lookup/visible/?o=%5Bnull%2Cnull%2C%22' . $this->_id_social . '%22%5D'; $jsondata = GoogleUtil::FetchGoogleJSON($visible_url); $visiblepeople = $jsondata[2]; //Zend_Debug::dump($visiblepeople);die(); foreach ($visiblepeople as $pdata) { $googleplus_id = $pdata[0][2]; $name = $pdata[2][0]; // if ( preg_match( '/^([\w\.\s]+) (\w+)$/', $name, $matches ) ) { // $first_name = $matches[1]; // $last_name = $matches[2]; // } else { // $first_name = $name; // } $image = $pdata[2][8]; $this->_friends[$googleplus_id]['name'] = $name; $this->_friends[$googleplus_id]['image'] = $image; $this->_friend_ids[] = '\'' . $googleplus_id . '\''; } } } return $this->_friends; }