physaux Posted December 18, 2009 Share Posted December 18, 2009 Hey guys, I am trying to write some code to get the referring url to my page, and then do something unique accordingly. So here is my code so far: $ref = getenv("HTTP_REFERER"); $goodvideoID = xxxxxxxxx //11 characters long How can I check if the goodvideoID is in the ref url? I am trying with preg match but I keep getting errors... :'( Quote Link to comment https://forums.phpfreaks.com/topic/185618-using-regex-pregmatch-to-read-youtube-video-id-from-url/ Share on other sites More sharing options...
rajivgonsalves Posted December 18, 2009 Share Posted December 18, 2009 you can use parse_url and then use parse_str http://php.net/manual/en/function.parse-url.php http://php.net/manual/en/function.parse-str.php Quote Link to comment https://forums.phpfreaks.com/topic/185618-using-regex-pregmatch-to-read-youtube-video-id-from-url/#findComment-980045 Share on other sites More sharing options...
cags Posted December 18, 2009 Share Posted December 18, 2009 If all you want to know is whether $goodvideoID is contained in $ref you could use stristr. Quote Link to comment https://forums.phpfreaks.com/topic/185618-using-regex-pregmatch-to-read-youtube-video-id-from-url/#findComment-980051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.