简体   繁体   English

在bingbot的PHP中未检测到URL请求参数

[英]URL Request parameters not detected in PHP for bingbot

I have a bizarre thing happening, bingbot is spidering my website, and one such URL looks like this: 我发生了一件奇怪的事情,bingbot正在搜寻我的网站,其中一个这样的URL如下所示:

https://xxxxx/programme.php?action=view&id=2233 https://xxxxx/programme.php?action = view&id = 2233

In my code, I have this function: 在我的代码中,我具有以下功能:

function getNumericValue($value) {
    if (is_numeric($value)) {
            return mysql_escape_string($value);
    }
    if (isset($_GET[$value])) {
            if (!is_numeric($_GET[$value])) {
                    echo "$value must be numeric.";
                    exit;
            }
            return mysql_escape_string($_GET[$value]);
    } if (isset($_POST[$value])) {
            if (!is_numeric($_POST[$value])) {
                    echo "$value must be numeric.";
                    exit;
            }
            return mysql_escape_string($_POST[$value]);
    } else {
            echo "Please specify a $value";
            debug("Please specify a $value - " .$_SERVER['REQUEST_URI'].' : '.$_SERVER['HTTP_USER_AGENT'].' : '.print_r($_POST, true).' USERID: '.getUserid());
            exit;
    }

} }

The debug() function emails me errors every 15 minutes, and when microsoft spider the site, I am getting: Please specify a id - /programme.php?action=view&id=2233 : msnbot-NewsBlogs/2.0b (+http://search.msn.com/msnbot.htm) : Array ( ) USERID: -1 debug()函数每15分钟通过电子邮件向我发送一次错误消息,并且当Microsoft Spider进入该网站时,我得到:请指定一个ID-/programme.php?action=view&id=2233:msnbot-NewsBlogs/2.0b(+ http:/ /search.msn.com/msnbot.htm):数组()用户ID:-1

You can see from the URL that it has an id, but PHP is totally ignoring it. 您可以从URL中看到它有一个id,但是PHP完全忽略了它。 It is fine for google spiders. 对于Google蜘蛛来说很好。

Any ideas what could be happening, and how to fix it? 有什么想法会发生什么,以及如何解决?

Wild guess - maybe there's an extra space after id number and is_numeric('2233 ') returns false. 大胆的猜测-编号后可能还有多余的空格,而is_numeric('2233')返回false。 Try trimming the value taken from $_GET/$_POST (or $_REQUEST for that matter): 尝试修剪从$ _GET / $ _ POST(或$ _REQUEST)获取的值:

function getNumericValue($value) {
    if (is_numeric($value)) {
            return mysql_escape_string($value);
    }

    if (isset($_REQUEST[$value])) {
            $request_value = trim($_REQUEST[$value]);
            if (!is_numeric($request_value)) {
                    echo "$value must be numeric.";
                    exit;
            }
            return mysql_escape_string($request_value);
    }

    echo "Please specify a $value";
    debug("Please specify a $value - " .$_SERVER['REQUEST_URI'].' : '.$_SERVER['HTTP_USER_AGENT'].' : '.print_r($_POST, true).' USERID: '.getUserid());
    exit;
}

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

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