Created
December 30, 2014 11:42
-
-
Save chiqui3d/763755ea2dccbe82a70a to your computer and use it in GitHub Desktop.
From http://stackoverflow.com/questions/1805296/get-keyword-from-a-search-engine-referrer-url-using-php
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 referrer | |
$referrer = 'http://www.google.com/search?hl=en&q=learn+php+2&client=firefox'; | |
// Parse the URL into an array | |
$parsed = parse_url( $referrer, PHP_URL_QUERY ); | |
// Parse the query string into an array | |
parse_str( $parsed, $query ); | |
// Output the result | |
echo $query['q']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment