Created
July 4, 2015 22:13
-
-
Save Shaz3e/b95bcff5aba96ab5e568 to your computer and use it in GitHub Desktop.
Extract keywords from a webpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The title said it all: A great code snippet to easily extract meta keywords from any webpage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$meta = get_meta_tags('http://www.emoticode.net/'); | |
$keywords = $meta['keywords']; | |
// Split keywords | |
$keywords = explode(',', $keywords ); | |
// Trim them | |
$keywords = array_map( 'trim', $keywords ); | |
// Remove empty values | |
$keywords = array_filter( $keywords ); | |
print_r( $keywords ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment