Załóżmy, że mam bazę z adresami IP serwerów Counter Strike. Potrzebuję średnio co 20 minut aktualizować sobie informacje o każdym z tych serwerów i zapisywać to do bazy. Zastanawiam się jednak po pierwsze jakiej biblioteki użyć do wyciągania informacji o serwerach. Obecnie stosuję bibliotekę GameQ: http://gameq.sourceforge.net/
Póki co dla próby wyciągnąłem sobie informacje o jakimś tam serwerze w ten sposób:
{ $gq = new GameQ(); // dodajemy serwer $gq->setOption('timeout', 200); $gq->setFilter('normalise'); $gq->setFilter('sortplayers', 'gq_ping'); $results = $gq->requestData(); if($results['serwer']['gq_hostname']=="") { } else { foreach($results['serwer'] AS $jeden => $dwa) { if ( $jeden !== 'players' ) { } else { for($i=0; $i <=$num; $i++) { } } } }
I skrypt wyciąga naprawdę sporo informacji o serwerze, zapewne sam właściciel serwera nie wie tyle co ja mogę dzięki temu skryptowi wiedzieć o jego serwerze. Jednak wziąłem powyższy skrypt w pętlę for i wykonałem skrypt 24 razy, dostałem czas ponad 5 sekund i kilka ostatnich rekordów wyrzuciło mi jako "Serwer is offline", mimo tego, że cały czas sprawdzałem ten sam serwer. Dodatkowo przy zmianie wartości pętli z 24 na 25 już dostałem:
Cytat
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@mypage.xaa.pl and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@mypage.xaa.pl and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
A przy wykonaniu pętli 23 razy, skrypt wykonuje się w pół sekundy. Nie wiem czemu jedno wykonanie w tą czy w tamtą robi tak olbrzymią rozbieżność czasową.
I teraz zastanawiam się:
a) czy ten skrypt jeśli chodzi o optymalność jest dobry? Może ktoś zna coś lepszego?

Pozdrawiam!
