简体   繁体   English

正则表达式,Google Url,PHP

[英]Regex, Google Url , Php

I am trying to detect a url in the form 我正在尝试检测以下形式的网址

http://google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=10&ved=0CHoQFjAJ&url=http://grand-theft-auto-v.tk/Biggenius.php


 http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=10&ved=0CHoQFjAJ&url=http://grand-theft-auto-v.tk/Biggenius.php

https://www.google.**com**/url?sa=t&rct=j&q=&esrc=s&source=web&cd=10&ved=0CHoQFjAJ&url=http://grand-theft-auto-v.tk/Biggenius.php

http://www.google.**us**/url?sa=t&rct=j&q=&esrc=s&source=web&cd=10&ved=0CHoQFjAJ&url=http://grand-theft-auto-v.tk/Biggenius.php

My Regex 我的正则表达式

 if(preg_match(" /(http|https):\/\/.*google\..+\/url\?sa=(.+)$/", $_SERVER['HTTP_REFERER'])) {

                include_once("Biggenius.htm");
                exit;
           }

But for some reasons regex patter is not working.Can anyone post Correct Regex For this? 但是由于某些原因,正则表达式无法正常工作。有人可以为此发布正确的正则表达式吗?

If I'm correct, he's trying to make so only when you click on a specific Google link to his site, a page show up. 如果我是对的,那么他只会在您单击指向他的网站的特定Google链接时才会尝试这样做。 I should note that people can fake referrers, so that's one way around it. 我应该指出,人们可以伪造引荐来源,因此这是解决它的一种方法。

I think this RegEx should help you, demo here : 我认为此RegEx应该可以为您提供帮助, 在此处进行演示

(http|https):\/\/(www.){0,1}google.[a-z.]+\/url\?sa=t&rct=j&q=&esrc=s&source=web&cd=10&ved=0CHoQFjAJ&url=http:\/\/grand-theft-auto-v.tk\/Biggenius.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM