PHP如何检查blogspot中删除的博客?

时间:2015-10-02 09:11:26

标签: php blogspot get-headers

我想查看博客状态,有效或已删除。

Active blog:
http://novisadcats.blogspot.com/  

Removed blog:
http://cityofangell.blogspot.com/

Removed blog, but available to register:
http://madhouseofporn.blogspot.com/

我正在尝试使用php get_headers(); 我可以检查该博客是处于活动状态还是已删除,但如何检查博客状态是否已删除但可以注册?

示例结果:

Active blog:
$headers = get_headers("http://novisadcats.blogspot.com/");
echo $headers[12]; // HTTP/1.0 200 OK

Removed blog:
$headers = get_headers("http://cityofangell.blogspot.com/");
echo $headers[12]; // HTTP/1.0 404 Not Found

Removed blog, but available to regsiter:
$headers = get_headers("http://madhouseofporn.blogspot.com/");
echo $headers[12]; // HTTP/1.0 404 Not Found

感谢您的帮助...

1 个答案:

答案 0 :(得分:1)

您有4个选项

  1. 手动检查。
  2. 假设如果网址返回404 ,则可能可用。
  3. 您可以尝试抓取主页,并在输入域时查看是否返回“确定”。这可以使用诸如DomCrawler Component(http://symfony.com/doc/current/components/dom_crawler.html
  4. 之类的工具来完成
  5. “黑客” - 方式。可能不应该这样做。查找Blogger在检查域可用性时请求的“网址”(Google Chrome开发人员工具,网络跟踪),并尝试模拟您的请求。
  6. 但是我可能会继续询问支持部门,并询问是否有办法检查,或者上述任何选项是否可行。