Is there a way or a tool to automatically visit all pages of my site

守給你的承諾、 提交于 2019-12-10 16:18:17

问题


I want to automatically visit / crawl all the pages on my site in order to generate a cache file. Is there any way or tool to do this?


回答1:


Just use any robot that downloads your entire page:

https://superuser.com/questions/14403/how-can-i-download-an-entire-website

For example wget:

wget -r --no-parent http://site.com/songs/



回答2:


You can use wget's recursive option to do this. Change example.com to your domain:

wget --recursive --no-parent --domains=example.com --level=inf --delete-after



回答3:


do you use a CMS? do you have a list of your pages? you could write a simple PHP loop to load all pages using CURL or php fopen()

$pages_ar = array(
    "http://mydomain.com/page1.htm",
    "http://mydomain.com/page2.htm",
    "http://mydomain.com/page2.htm",
);

foreach($pages_ar as $page)
{
   fopen($page, "r");
}

basic but I hope you get the idea...




回答4:


surfen's method is correct but if you want a php solution you can check Symfony 2-s BrowserKit component which can be used as a stand alone component.

https://github.com/symfony/BrowserKit



来源:https://stackoverflow.com/questions/9944841/is-there-a-way-or-a-tool-to-automatically-visit-all-pages-of-my-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!