{"id":721,"date":"2011-01-27T10:14:35","date_gmt":"2011-01-27T17:14:35","guid":{"rendered":"http:\/\/sp2hari.com\/?p=721"},"modified":"2020-06-20T08:26:36","modified_gmt":"2020-06-20T08:26:36","slug":"remove-all-your-friends-from-facebook","status":"publish","type":"post","link":"https:\/\/sp2hari.com\/index.php\/2011\/01\/27\/remove-all-your-friends-from-facebook\/","title":{"rendered":"Remove all your friends from Facebook."},"content":{"rendered":"<p>Very rarely, you will want to delete all friends from Facebook and start a &#8220;fresh&#8221; facebook account.<\/p>\n<p>Now, it&#8217;s hard to do this manually. Thanks to phpunit + selenium + a few lines of code, this can be done now.<\/p>\n<p>The following script removes all your friends from facebook \ud83d\ude42 Replace <account-name> and <password> with your username and password respectively. <\/password><\/account-name><\/p>\n<p><code><br \/>\n&lt;?php<br \/>\nrequire_once&nbsp;'PHPUnit\/Extensions\/SeleniumTestCase.php';<br \/>\nclass&nbsp;Example&nbsp;extends&nbsp;PHPUnit_Extensions_SeleniumTestCase<br \/>\n{<br \/>\n&nbsp;&nbsp;protected&nbsp;function&nbsp;setUp()<br \/>\n&nbsp;&nbsp;{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setBrowser(\"*chrome\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setBrowserUrl(\"http:\/\/www.facebook.com\/\");<br \/>\n&nbsp;&nbsp;}<br \/>\n&nbsp;&nbsp;public&nbsp;function&nbsp;testMyTestCase()<br \/>\n&nbsp;&nbsp;{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;open(\"\/\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;type(\"email\",&nbsp;\"&lt;username&gt;\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;type(\"pass\",&nbsp;\"&lt;password&gt;\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;click(\"\/\/input[@value='Login']\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;waitForPageToLoad(\"90000\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;for($i=0;&nbsp;$i&lt;1000;&nbsp;$i++)&nbsp;{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;click(\"link=Profile\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;waitForPageToLoad(\"90000\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;click(\"\/\/a[@href='http:\/\/www.facebook.com\/sp2hari?sk=friends&amp;v=friends']\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;waitForPageToLoad(\"90000\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;click(\"\/\/div[@class='fbProfileLargePortrait']\/a\/\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;waitForPageToLoad(\"90000\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;click(\"link=Unfriend\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep(5);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;click(\"remove-friend\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;waitForPageToLoad(\"90000\");<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>\n&nbsp;&nbsp;}<br \/>\n}<br \/>\n?&gt;<br \/>\n<\/code><\/p>\n<p>Note:<br \/>\n1. The script will stop in between with timeout error. You probably should run this script in an infinite loop.<br \/>\n2. Once you&#8217;ve reached 0 friends, facebook blocks you from adding friends in bulk for 2 days. So, you probably have to wait till facebook trusts you as human and not a bot. \ud83d\ude42<\/p>\n<p>Happy hacking \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Very rarely, you will want to delete all friends from Facebook and start a &#8220;fresh&#8221; facebook account. Now, it&#8217;s hard to do this manually. Thanks to phpunit + selenium + a few lines of code, this can be done now. The following script removes all your friends from facebook \ud83d\ude42 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-721","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/comments?post=721"}],"version-history":[{"count":11,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/721\/revisions"}],"predecessor-version":[{"id":1346,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/721\/revisions\/1346"}],"wp:attachment":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/media?parent=721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/categories?post=721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/tags?post=721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}