Home > Backend Development > PHP Tutorial > Supplement on how to cross-site crawl pages of other sites, crawl site pages_PHP tutorial

Supplement on how to cross-site crawl pages of other sites, crawl site pages_PHP tutorial

WBOY
Release: 2016-07-13 10:15:13
Original
996 people have browsed it

How to cross-site crawl the pages of other sites, crawl the site pages

In actual applications, we often encounter some special situations, such as the need for news , weather forecast, etc., but as a personal site or a small site, we cannot have so much manpower, material and financial resources to do these things, what should we do?
Fortunately, the Internet is resource sharing. We can use programs to automatically capture pages from other sites and process them for us to use.
What should I use? What the comrade gave me doesn’t work. In fact, Php has this function, which is to use the curl library. Please look at the code below!

$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);
?>

Details: http://php.662p.com/thread-504-1-1 .html

How to solve the cross-site problem?


Changed to

That's it

There are multiple websites on the vps. How to set up directory security to prevent cross-site intrusion?

Set a permission for a website so that even if website A is invaded, website B cannot be invaded across sites. If you don’t know much, it is recommended to install a host management system, such as the free N-point host management system. The space opened in this way automatically assigns a permission for you.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/905900.htmlTechArticleHow to cross-site crawl the pages of other sites. In actual applications, crawling site pages is often There will be some special situations, such as needing news, weather forecast, etc., but...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template