public function GetWatchers($userid, $start_page = 1) { /** * Lets first test if this page is correct */ $page = new Page("http://www.furaffinity.net/budslist/?uid={$userid}&mode=watched_by", $this->cookies); /** * If this link is invalid */ if ($page == null) { return false; } /** * Now, lets set a few variables up */ $return = array(); /** * where do we start counting from? */ $counter = $start_page; /** * Then, lets loop! */ while (true) { $page = new Page("http://www.furaffinity.net/budslist/?uid={$userid}&page={$counter}&mode=watched_by", $this->cookies); if ($page == null) { break; } /** * Lets first check if they have watchers on this page */ if ($this->NoWatchers($userid, $counter)) { break; } /** * Else... */ $element = $page->FindID("table", "userpage-budlist"); if ($element == null) { break; } $rows = $page->FindMembers($element, "tr"); if ($rows != null) { foreach ($rows as $key => $value) { $link = $page->FindMembers($value, 'a')[0]; if ($link == null) { break; } $user = explode("/", $page->GetQuotation($link, 0))[2]; if ($user == null) { break; } array_push($return, $user); } } /** * Then, lets advance our counter */ $counter += 1; } /** * Once we've exited our while loop, lets give a result */ if ($return != null) { return $return; } /** * Else.. return null! */ return null; }