开发者

How can I scrape a page and extract all linked resources' urls in php?

I'm actually wondering if there's some library or code available to do this with. Essentially, all I need to do is scrape a page with PHP, including it's CSS files, JavaScript, and images, and replace those URL'开发者_Python百科s in the code with the URL of a local copy.

Any help or links to info on the subject would be really appreciated. Thank you.


SimpleHTMLDom - see the examples on the homepage for an easy method to extract and loop through links


$new_page_content = str_replace( $old_url, $new_url, $page_content );

PHP Manual: str_replace()

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜