Home > php教程 > php手册 > body text

如何跨站抓取别的站点的页面的补充,抓取站点页面

WBOY
Release: 2016-06-13 09:22:20
Original
907 people have browsed it

如何跨站抓取别的站点的页面的补充,抓取站点页面

在实际的应用中,经常会遇到一些特殊的情况,比如需要新闻,天气预报,等等,但是作为个人站点或者实力小的站点 我们不可能有那么多的人力 物力 财力去做这些事情,怎么办呢?  
好在互联网是 资源共享的,我们可以利用程序 自动的把别的站点的页面抓取回来经过处理后被我们所利用。 
  用什么呢,那个战友给的是不行的,其实在Php有这个功能,那就是用curl库。请看下面的代码!  

$ch = curl_init ("http://dailynews.sina.com.cn"); 
$fp = fopen ("php_homepage.txt", "w"); 

curl_setopt ($ch, CURLOPT_FILE, $fp); 
curl_setopt ($ch, CURLOPT_HEADER, 0); 

curl_exec ($ch); 
curl_close ($ch); 
fclose ($fp); 
?> 

详细说明:http://php.662p.com/thread-504-1-1.html

问怎解决跨站问题?


改为

即可
 

vps上面放多个网站,怎设置目录安全可以防止跨站入侵?

一个网站设置一个权限,这样即使A网站被入侵,也无法跨站入侵B网站。如果不太懂,建议安装主机管理系统,比如免费的N点主机管理系统。这样开通的空间自动帮你分配了一个权限。
 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!