<?php function doSearch ($url) { foreach ($data as $item) { } } } doSearch ('http://gazeta.pl'); ?>
Skrypt działa bardzo wolno, ale jest pisany do użytku w konsoli, więc to akurat nie jest problemem...
Wynikiem puszczenia skryptu jest lista adresów URL na danej stronie. Oto przykład opierający się o stronę framework.zend.com:
Kod
fipaj@ubuntu:/home/server$ php search.php
phpSearchEngine 1.0
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/1999/xhtml
http://www.zend.com/rss.php?type=press
http://www.zend.com/press.php?id=312&single=1
http://www.zend.com/press.php?id=311&single=1
http://www.zend.com/press.php?id=309&single=1
http://www.zend.com/press.php?id=308&single=1
http://feeds.feedburner.com/ZendDeveloperZone
http://feeds.feedburner.com/ZendDeveloperZone?m=1
http://feeds.feedburner.com/ZendDeveloperZone?m=2
http://feeds.feedburner.com/ZendDeveloperZone?m=3
http://feeds.feedburner.com/ZendDeveloperZone?m=4
http://www.php.net
http://www.zend.com
http://devzone.zend.com
http://devzone.zend.com/
http://framework.zend.com/contributors
http://framework.zend.com/roadmap/future/
http://framework.zend.com/download
fipaj@ubuntu:/home/server$
phpSearchEngine 1.0
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/1999/xhtml
http://www.zend.com/rss.php?type=press
http://www.zend.com/press.php?id=312&single=1
http://www.zend.com/press.php?id=311&single=1
http://www.zend.com/press.php?id=309&single=1
http://www.zend.com/press.php?id=308&single=1
http://feeds.feedburner.com/ZendDeveloperZone
http://feeds.feedburner.com/ZendDeveloperZone?m=1
http://feeds.feedburner.com/ZendDeveloperZone?m=2
http://feeds.feedburner.com/ZendDeveloperZone?m=3
http://feeds.feedburner.com/ZendDeveloperZone?m=4
http://www.php.net
http://www.zend.com
http://devzone.zend.com
http://devzone.zend.com/
http://framework.zend.com/contributors
http://framework.zend.com/roadmap/future/
http://framework.zend.com/download
fipaj@ubuntu:/home/server$
No więc wszystko bardzo fajnie, ale postanowiłem dodać możliwość podążania za linkami.
<?php function doSearch ($url) { foreach ($data as $item) { doSearch ($item); } } } doSearch ('http://framework.zend.com'); ?>
I teraz skrypt nie działa. To znaczy nie działa tak, jak powinien:
Kod
fipaj@ubuntu:/home/server$ php search.php
phpSearchEngine 1.0
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
// i tak aż do błędu o przekroczonym jakimś limicie...
phpSearchEngine 1.0
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
// i tak aż do błędu o przekroczonym jakimś limicie...
Czy ma ktoś pomysł na rozwiązanie tego problemu? Byłbym wdzięczny, nic nie mogę wymyślić

PS. 500. post ;]
Przepraszać, rozwiązać sam
