Skip to content

Instantly share code, notes, and snippets.

@Shaz3e
Created July 4, 2015 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shaz3e/b95bcff5aba96ab5e568 to your computer and use it in GitHub Desktop.
Save Shaz3e/b95bcff5aba96ab5e568 to your computer and use it in GitHub Desktop.
Extract keywords from a webpage
The title said it all: A great code snippet to easily extract meta keywords from any webpage.
$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