Home > Backend Development > PHP Tutorial > PHP intercepts remote web page information_PHP tutorial

PHP intercepts remote web page information_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:50:19
Original
840 people have browsed it

The following program code will introduce how to intercept remote web page information, including Title, Description and Keywords in the HTML tag:

PLAIN TEXT
PHP:
//—–Define the web page address to be intercepted
$url = "http:// www.2cto.com ";
//—– Read the source code of the web page
$fp = file_get_contents($url);
//—– Intercept title information
preg_match(“/(.*)/s”, $fp, $match);
$title = $match[1];
//—– Intercept Description and Keywords
$metatag = get_meta_tags($url);
$description = $metatag["description"];
$keywords = $metatag["keywords"];
//—–Print the results
echo “URL: $urln”;
echo “Title: $titlen”;
echo “Description: $descriptionn”;
echo “Keywords: $keywordsn”;
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478263.htmlTechArticleThe following program code will introduce how to intercept remote web page information, including Title, Description and Keywords in the HTML tag: PLAIN TEXT PHP: ?php //Define the web page address to be intercepted $url = ht...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template