Asked 7 years ago
6 Mar 2017
Views 1478
jessica

jessica posted

how to prevent website scrapping ?

how to prevent website scrapping ? , i have doubt some other crawler is scrapping my website and copying data to their website so how can i prevent site to be scrapped ?

how to avoid crawl to website from all other server / website except some search engine (google ./ bing / yahoo etc.)
Phpworker

Phpworker
answered Nov 30 '-1 00:00

To prevent website scrapping . you need to identify request coming from human or machine , mostly server have cron (program) which scrap site and grab the data(data mining).

you can put filter on all request , check if it is valid user or not .

to check is valid human or machine , you can do some filter on all request to your website
1. check whether its requested by browser or not . when cron or machine crawling by other server side scripting language than its not done by through the browser . web page requested by the server side language directly .

how to check is it browser called web page or script ?


 $useragent=$_SERVER['HTTP_USER_AGENT'];
if($useragent==''){
echo "Hi  i am machine ";
}
else {
echo "i called you by browser"
}


$_SERVER['HTTP_USER_AGENT'] give browser , mostly its empty for web crawler ,
Post Answer