Image via Wikipedia
Ever since announcing that I’d basically follow anyone who’s followed me, I had to come up with a way to make this happen in a timely, efficient process. So here’s how I do it, if you want to use this bizarre workflow yourself.
fu.php is more or less the magic sauce along with BBEdit. I do this once every day or so to sync up new followers, and it works like a charm. fu.php I run in the Mac OS Terminal. This process looks complex, but in reality, it takes all of 2 minutes to do at most.
Here’s the source code:
<?php
// curl twitter follow script
set_time_limit(3600);
function follow($username)
{
$url = “http://username:password@twitter.com/friendships/create/$username.json”;
if (!$curld = curl_init()) {
echo “Could not initialize cURL session.\n”;
exit;
}
echo $url;
if (!$curld = curl_init()) {
echo “Could not initialize cURL session.\n”;
exit;
}
curl_setopt($curld, CURLOPT_GET, true);
curl_setopt($curld, CURLOPT_URL, $url);
curl_setopt($curld, CURLOPT_HEADER, false);
curl_setopt($curld, CURLOPT_RETURNTRANSFER, true);
$output=curl_exec($curld);
//echo “Received data: \n\n$output\n\n”;
$pile=json_decode($output,true);
return $pile;
}
$handle = @fopen(”follow.txt”, “r”);
if ($handle) {
while (!feof($handle)) {
$users[] = fgets($handle, 4096);
}
fclose($handle);
}
foreach($users as $key=> $value){
$user=ereg_replace(”\n”,”",$value);
$result=follow($user);
print_r($result);
}
?>
Did you enjoy this blog post? If so, please consider subscribing for free!
Get this and other great articles from the source at www.ChristopherSPenn.com
Popularity: 11% [?]
Add New Comment
Viewing 3 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks