Follow a set of IDs

Uit dotSearch
Ga naar: navigatie, zoeken

// Follow de eerste 8 $message = ""; $username = 'dagacties'; $password = 'wachtwoord'; $maxfollows = 0; foreach($uchildids as $key => $value) { if ($maxfollows < 8) { //$apiurl = 'http://twitter.com/friendships/create/'.$key.'.xml'; $apiurl = 'http://twitter.com/friendships/create.xml?user_id='.$key.'&follow=true'; $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, "$apiurl"); 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 = curl_exec($curl_handle); curl_close($curl_handle); // check for success or failure if (empty($buffer)) { echo 'no new follows...'; $maxfollows++; } else { echo 'successfully following '.$key.'<br />'; $maxfollows++; } } }