Created
September 24, 2010 14:20
-
-
Save kwylez/595456 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 | |
require_once 'Zend/Service/Twitter.php'; | |
class CW_Twitter extends Zend_Service_Twitter { | |
public function __construct($username, $password) { | |
parent::__construct($username, $password); | |
} | |
public function getOtherUserFriends($name) { | |
$this->_init(); | |
$path = '/followers/ids/' . $name . '.json'; | |
$response = $this->restGet($path); | |
return $response->getBody(); | |
} | |
} | |
$twitter = new CW_Twitter('username', 'password'); | |
$response = $twitter->getOtherUserFriends('friendusername'); | |
$arrayObject = new ArrayObject(Zend_Json::decode($response)); | |
$limitIterator = new LimitIterator($arrayObject->getIterator(), 0, 200); | |
foreach ($limitIterator as $value): | |
$twitter->friendship->create($limitIterator->current()); | |
endforeach; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment