/ Published in: PHP
Modified version of the script created by Dave Stevens, Enables the user to input their credentials on a webpage rather than having to change the actual php script code.
Changes: Changed $user,$pass,$term
This is a modified script, the original can be found here: http://snipplr.com/view/17595/twitter-autofollow-php-script/
Changes: Changed $user,$pass,$term
This is a modified script, the original can be found here: http://snipplr.com/view/17595/twitter-autofollow-php-script/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<html> <head> <title>Twitter Follow Script - Jonathon Maguire</title> </head> <body> <center> <u><h1><i>Twitter Follow Script</i></h1></u> <style> div { border: .2em dotted #900; } #border { border-width: .2em; border-style: solid; border-color: red; } </style> <form method="post" action=""> <div id="border"> <p><u>Username:</u></p> <input type="text" name="username" value=""> <br><p><u>Password:</u></p> <input type="password" name="password" value=""> <br><p><u>Search Term</u></p> <input type="text" name="term" value=""><br> <input type="submit" name="submit" value="submit"> </div> </center> </body> </html> <?php // Twitter Auto-follow Script by Dave Stevens - http://davestevens.co.uk, Modified by Jonathon Maguire, http://www.unknowntruth.net { // Set the twitter user $user = $_POST['username']; $pass = $_POST['password']; // Set the term you want to follow (e.g. "soccer") $term = $_POST['term']; // Get already followed $userApiUrl = "http://twitter.com/statuses/friends.json"; if ($apiresponse) { if ($json != null) { foreach ($json as $u) { $followed[] = $u->name; } } } $userApiUrl = "http://search.twitter.com/search.json?q=" . $term . "&rpp=100"; if ($apiresponse) { $count = 90; if ($results != null) { $resultsArr = $results->results; foreach ($resultsArr as $result) { $from_user = $result->from_user; if ($apiresponse) { if ($response != null) { if (property_exists($response,"following")) { if ($response->following === true) { echo "Now following " . $response->screen_name . "\n"; } else { echo "Couldn't follow " . $response->screen_name . "\n"; } } else { echo "Follow limit exceeded, skipped " . $from_user . "\n"; } } } } else { echo "Already following " . $from_user . "\n"; } } } } } } ?>
URL: http://www.davestevens.co.uk