Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
A script to check how much a website is likely to be p0rn
Old 03-10-2010, 10:53 AM A script to check how much a website is likely to be p0rn
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
Hi Guys,

I had made a script to use google search service to estimate how possible a website having p0rn contents. And just thought to share it with you.

PHP Code:
function send_query($url,$safe='active')
{
    
$res=strip_tags(file_get_contents('http://www.google.com/search?q=' urlencode('site:' $url) . '&safe=' $safe));
    
preg_match('/Results 1 - [0-9]+ of (about)? ([0-9]+(,[0-9]{3})*) from/i',$res,$matches);

    return 
str_replace(',','',$matches[2]);
}

function 
get_info($url)
{
    if(
strpos($url,'http://')!==false)
        
$url=parse_url($url,PHP_URL_HOST);//extract domain

    
$info['safe_pages']=send_query($url);
    
$info['all_pages']=send_query($url,'off');

    if(empty(
$info['all_pages']))
        
$info['prating']=-1;

    else
        
$info['prating']=round(10*$info['safe_pages']/$info['all_pages'],2);

    return 
$info;
}
print_r(get_info($_GET['url'])); 
To use this code simply copy and past it into an empty file say 'check_url.php'

then upload that file to your website and open it like that
Code:
check_url.php?url=domain.com
You will get a value called prating.
From my observation you can use this value to guess the following results
  • prating = -1 unknown (website not listed or blocked by google).
  • 0 <= prating < 1 this is a p0rn site.
  • 1 <= prating < 4 probably this is not p0rn site but friendly toward p0rn.
  • 4 <= prating < 8 it doesn't allow p0rn but can be indirectly linking in some way to sites that allow or support p0rn.
  • 8<= prating < 10 this website is very safe for general audience.

Note: Please use that script for personal use only and be careful not to overuse it in a short time or google may block your ip.

Hoping it will be useful
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");
nayes84 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to A script to check how much a website is likely to be p0rn
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08163 seconds with 12 queries