Follow a set of IDs: verschil tussen versies
(Nieuwe pagina aangemaakt met '// Follow de eerste 8 $message = ""; $username = 'dagacties'; $password = 'wachtwoord'; $maxfollows = 0; foreach($uchildids as $key => $value) { if ($maxfollows < 8…') |
|||
| Regel 1: | Regel 1: | ||
| − | // Follow de eerste 8 | + | <math>// Follow de eerste 8 |
$message = ""; | $message = ""; | ||
| Regel 29: | Regel 29: | ||
} | } | ||
} | } | ||
| + | </math> | ||
Versie van 30 dec 2009 om 13:00
<math>// 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.'
';
$maxfollows++;
}
}
}
</math>