开发者

Is there such a thing as a converter from php to html?

开发者 https://www.devze.com 2022-12-30 20:11 出处:网络
Don\'t think that I\'m mad, I understand how php works! That being said. I develop personal website and I usu开发者_JAVA技巧ally take advantage of php to avoid repetion during the development phase n

Don't think that I'm mad, I understand how php works!

That being said. I develop personal website and I usu开发者_JAVA技巧ally take advantage of php to avoid repetion during the development phase nothing truly dynamic, only includes for the menus, a couple of foreach and the likes.

When the development phase ends I need to give the website in html files to the client. Is there a tool (crawler?) that can do this for me instead of visiting each page and saving the interpreted html?


You can use wget to download recursively all the pages linked.

You can read more about this here: http://en.wikipedia.org/wiki/Wget#Recursive_download


If you need something more powerful that recursive wget, httrack works pretty well. http://www.httrack.com/


Pavuk offers much finer control than wget. And will rewrite the URLs in the grabbed pages if required.


If you want to use a crawler, I would go for the mighty wget.

Otherwise you could also use some build tool like make.

You need to create a file nameed Makefile in the same folder of your php files.
It should contain this:

all: 1st_page.html 2nd_page.html 3rd_page.html

1st_page.html: 1st_page.php
    php command

2nd_page.html: 2nd_page.php
    php command

3rd_page.html: 3rd_page.php
    php command

Note that the php command is not preceded by spaces but by a tabulation. (See this page for the php command line syntax.)

After that, whenever you want to update your html files just type

make

in your terminal to automatically generate them.

It could seem a lot of work for just a simple job, but make is a very handy tool that you will find useful to automate other tasks as well.


Maybe, command line will help?


If you're on windows, you can use Free Download Manager to crawl a web-site.

0

精彩评论

暂无评论...
验证码 换一张
取 消