PHP intercepts remote webpage information. The following code describes how to intercept remote webpage information, including the Title, Description, and Keywords: PLAINTEXTPHP :? Php defines the URL of the web page to be intercepted $ urlht the following program code will introduce how to intercept remote webpage information, including the Title, Description and Keywords in the HTML tag:
PLAIN TEXT
PHP:
// -- Define the URL of the webpage to be intercepted
$ Url = "http: // www.2cto.com ";
// -- Read the original webpage code
$ Fp = file_get_contents ($ url );
// -- Capture title information
Preg_match ("/ (. *) <\/Title>/s ", $ fp, $ match );
$ Title = $ match [1];
// -- Intercept Description and Keywords
$ Paiag = get_meta_tags ($ url );
$ Description = $ metatag ["description"];
$ Keywords = $ metatag ["keywords"];
// -- Print the result
Echo "URL: $ url \ n ";
Echo "Title: $ title \ n ";
Echo "Description: $ description \ n ";
Echo "Keywords: $ keywords \ n ";
?>
Title, Description, and Keywords: plain text php :? Php // define the url of the webpage to be intercepted $ url = ht...