Unfollow Twitter Script

by greenovni 3 replies
Hello everyone, its been a while since I stopped by here and wanted to give you this little gift.

A lot of you have multiple twitter accounts for your niches and follow people in order to gain people following you back. Unfortunately with twitter, you can only follow up to 2,000 people at any one time.

Unfollowing by hand can be a real pain in the butt so here is a little PHP script that you can upload to your server and run every time you want to unfollow a ton of people at once

<?php
// Set username and password
$username = 'username';
$password = 'password';

// The twitter API address
$url = 'http://www.twitter.com/friends/ids.xml';
// Set up and execute the curl process
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_GET, 1);
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");

$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
// check for success or failure
if (empty($buffer)) {
echo 'Error';
} else {
echo '<h1>Success Connate</h1><hr>';
}
// xml to array
//
//echo $buffer ;
$xml = simplexml_load_string("$buffer");
foreach ($xml->children() as $child)
{
echo " $child ";
// The twitter API address
$url_2 = "http://twitter.com/friendships/destroy.xml?user_id=$child";
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url_2");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer_2 = curl_exec($curl_handle);
curl_close($curl_handle);
// check for success or failure
if (empty($buffer_2)) {
echo 'Error';
} else {
echo 'Go to hell<br/><hr>';
}

}
?>
Your server would need CURL in order to run this script.

Directions:

1. copy code into a txt file
2. Set your twitter user name and password
3. Save as whatever you want .php
4. upload to your web host
5. visit http://yourdomain.com/whateverscriptname.php
#main internet marketing discussion forum #script #twitter #unfollow
Avatar of Unregistered
  • Profile picture of the author sbucciarel
    Banned
    There's plenty of services around that allow you to mass unfollow, but mass unfollowing will most likely get your Twitter acct banned.

    Here's a techcrunch articles that shows Twitter's TOS regarding automation and bulk unfollows.

    6 Million Unfollows Later, Twitter Moves To Silence ManageTwitter

    Twitter Karma also received the same instructions from Twitter
    {{ DiscussionBoard.errors[2060054].message }}
  • Profile picture of the author majidmaskat
    well sorry to say this but, there are other website which offer this service fairly rather qucikly. So much appreaciated for the code, but it is already out there
    {{ DiscussionBoard.errors[2060119].message }}
  • Profile picture of the author greenovni
    There might be someone out there that would need the code, at least that is what I thought
    {{ DiscussionBoard.errors[2061838].message }}
Avatar of Unregistered

Trending Topics

  • 118 {{ upvoteCount | shortNum }}

    Tons of Bad Advice In This Thread

    Most people that come to the forum are looking for advice on how to build their business or to otherwise make more money. Thanks to all those willing to help ... [read more]

  • 1 {{ upvoteCount | shortNum }}

    Advice Please - Even if It means Paying for a service I wouldn't mind

    Viralgaga Articles in Web Design

    I am a complete newbie as far as internet marketing and blogging is concerned. I have struggled for a while, buying some money making e books, I have also tried ... [read more]

  • 42 {{ upvoteCount | shortNum }}

    Internet Marketing VS Network Marketing

    noobz in Internet Marketing

    Last night I was invited to a small meeting and this guy who is in this one Network Marketing company happens to be the speaker. He claimed to make 6 ... [read more]

  • 2 {{ upvoteCount | shortNum }}

    Are You Hacking Your Internet Marketing Business to Death?

    I have read a slew of blog posts over the years which are heavily focused on hacks. Many of these bloggers and internet marketers are offering the quickest, most simple ... [read more]

  • 4 {{ upvoteCount | shortNum }}

    Big Traffic and Hosting Problems?

    aexonrazz20 in SEO

    Can you recommend me the hosting who can keep the site alive when traffic is high? I got some problems with the hosting, because when I have a peak time, ... [read more]