简体   繁体   中英

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解析器和遍历树,寻找和固定href上的属性a标签, src的属性img标签,等等等等解析器将能够重新发射的树作为一个字符串完成后。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM