Forum Moderators: coopster

Message Too Old, No Replies

Howto claim a website with php

         

asantos

6:51 am on Dec 11, 2006 (gmt 0)

10+ Year Member



Hi, i recently published a new service where users can add their blogs to their listings. But i need a way to proof that the user that adds a blog is the genuine owner of the blog in that matter.

Now, i have found a solution for blogs hosted on blogger through the API... my other solutions for non blogger blogs are:

A) the user adds a metatag in their index and my service somehow checks if the metatag exists and checks for a correct value (just like google sitemap does).

B) the user has to upload a file (hash.html) and my service checks if the file exists.

Ok... now i have two questions:
1) How can i do (A) and (B)?
2) Are there any other alternatives? It must be an easy to perform method for the final user.

barns101

11:23 am on Dec 11, 2006 (gmt 0)

10+ Year Member



You'd probably use file_get_contents() [php.net] and then either find a string with strpos() [uk.php.net] or use eregi() [uk.php.net] to perform a regular expression check for the correct text.

asantos

5:50 pm on Dec 11, 2006 (gmt 0)

10+ Year Member



Can someone provide an algorithm to find a proper meta tag with a proper value?

thanks

coopster

7:04 pm on Dec 11, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Do you mean a regular expression to extract meta name/value pairs?

mikesmith76

11:05 pm on Dec 11, 2006 (gmt 0)

10+ Year Member



Would it not be simpler to just have them upload an empty file with the hash as the name, as per google site validation. That way instead of having to parse the index page you just have to check for the existance of the file, and ignore it's contents.

restless

3:01 am on Dec 12, 2006 (gmt 0)

10+ Year Member



Just do as mikesmith76 says it's the easiest solution (Your B suggestion)

you can do this

$url = "path to the domain and filename you want to check";
$content = file_get_contents($url);

if (!$content ¦¦ $content == "" ¦¦ $content == null) {
//file not found and do whatever here
}

restless

3:04 am on Dec 12, 2006 (gmt 0)

10+ Year Member



also you should put an @ infront of the file_get_contents function like so

$content = @file_get_contents($url);

So then the browser does not spit out a file not found error

asantos

3:29 pm on Dec 13, 2006 (gmt 0)

10+ Year Member



Thanks for the recommendations.