file_get_contents只读取网页的部分内容,其实这就是采集文章最简单最原始的做法了。
在php教程中
file_get_contents函数可以打开本地文件,也可能读取远程文件
用法
file_get_contents( $url);
下面我们来看一下file_get_contents采集远程网站的内容的实例
代码如下 | 复制代码 |
$url = http://www.111cn.net $content = file_get_contents( $url); if( $content ) { $array = explode(' } else { echo '未采集成功'; } //如果成功输出为 array( 0=>网页制作教程教程--网页设计教程网-提供专业网页设计与网页制作教程 ) |
好了就做完了。
看看读取远程服务器内容的方法,可以和用fsockopen,fopen(需要设置allow_url_open)等函数来实现

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.