0
我有以下代碼,它完美地工作。但是我遇到了一個小問題:「$ username_index」計數。Loop「Addfriend」計數問題
我的代碼的主要思想是以下:
具有accounts.txt [92行]用戶名:通格式。 擁有usernames.txt [99999行]用戶名格式。
它將登錄到account1,然後它將添加95個用戶名,然後下一個account2,然後添加下95個用戶名。
但有些帳戶給出回覆「太多添加朋友」。在這種情況下,我將跳過該帳戶並轉到下一個。
但是下面的代碼將衝突到下一個95 !,所以它從用戶名跳過95!
我希望它contiue添加從跳過的帳戶的左側用戶名。
我希望它儘快登錄到下一個帳戶,並隨時添加下一行USERNAMES!無需跳轉到下一個95用戶名添加!
Example how i want it:
login account1
add username1
add username2
ERROR APPEARS!
login account2
add username3
add username4
add username5
add username6
error appears!
login account3
add username7
add username8
etc..
目前代碼:
$username_index = 0;
while(true) { // This is our while.. yes but this not for login()!
try {
$names = readFromFile("usernames.txt", 95, $username_index);
if(count($names) <= 0)
break;
sleep(1);
$fuckc = 0;
foreach($names as $name){
$ans = $API->addFriend($name);
$var_response = $ans->getMessage();
if (strpos($var_response, 'too many friends!') !== false) {
printf("[!] Too many friends!, Skipping account now.\n");
break;
}
if (strpos($var_response, 'Sorry') === false) {
$fuckc++;
printf("[+]" . "[" . date("h:i:s") . "]" . "[" . $fuckc . "] " . "response: " . $var_response . "\n");
//printf("[" . $fuckc . "] " . "response: " . $var_response . "\n");
}
//sleep(SLEEP_TIME);
}
$username_index += 95;
$API->logout();
//rotate_proxy();
$API = null;
//sleep(waiting);
//$results = $findFriends->getResults();
if (!isset($results) || count($results) == 0) {
if(!login()) die("Could not find a valid account.\n");
}
} catch(Exception $e){
echo $e->getMessage() . "\n";
if(!login()) die("Could not find a valid account.\n");
}
}
感謝您的關注。如果出現錯誤,代碼將移至下一個帳戶,或者如果完成95次添加。而已。 –
@mzabox,現在有什麼問題?我在這裏解決它。 –
現在你的代碼工作得很好,但它突然停止,它不會循環無限。 –