php: convert all relative urls in absolute urls
maybe this is an old question but i'm trying as a personal experiment to fetch a page form the web and the make a copy out of it with all the relative urls, links, href, src etc withn absolute urls
i'm using CURL to fetch hte page and I have now a $html variable that contains all the code..
so what; the next step? shoud i use preg_replace? how?
thanks
下一步是将它放入一个HTML解析器中,并遍历树,查找和修复标签上a
href
属性, img
标签上a
src
属性等等。解析器将能够将该树重新发射为一个字符串一旦你完成了。
上一篇: 对所有外部链接空白
下一篇: php:将所有相关网址转换为绝对网址