【问题标题】:How to verify the ownership of a website?如何验证网站的所有权?
【发布时间】:2011-04-03 14:53:41
【问题描述】:

我想创建一个标签以允许用户声明其网站的所有权。

我将如何获取标签并将其与我生成的标签进行匹配。

标签格式为<!--tag-->

如果我能够使用file_Get_contents("url"); 获取 html,我将如何验证此标签

【问题讨论】:

  • 所有权?你是说域名吗?你打算用什么编程语言?

标签: validation web verify ownership


【解决方案1】:

这只是一个字符串匹配。

<?php
$tagCode = "<!-- abc123 -->";
$pageContent = file_get_contents("http://www.somesite.com/");

if (strpos($pageContent, $tagCode) !== false) {
    echo "it matched!";
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-15
    • 1970-01-01
    相关资源
    最近更新 更多