How to block the loading of a specific page?

I read that spammers can load a specific registration page on my site using curl. Is there a way to block this particular page from CURLed, either through htaccess or other means?

+2


a source to share


3 answers


I don't think it is possible to block curl as curl has the ability to send user agents, cookies, etc. As I understand it, it can completely emulate a normal user.



If you are worried about securing the form, you can create a random token that is sent automatically when the form is submitted. So anyone trying to create a script to automate the registration will have to worry about clearing it up first.

+1


a source


There is one weakness in CURL that you can exploit, it cannot run javascript like a browser. So you can take advantage of this fact by first landing on the reg page, ask the server side code to check the cookie, if it is not there, send the JavaScript code to the browser, this code will set the cookie and do a redirect / reload ... after reloading the server side the side checks for the existence of the cookie again, including browsers, it will find it .. in case of curl, cookie generation and reload / redirect won't happen in the first place.



I hope I made some sense, bottom line ... use javascript to differentiate between curl and browser.

+1


a source


As Oren says, spammers can spoof user agents, so you can't just block the user agent curl line. The typical solution here is some CATPCHA . These are often mixed images (although there are non-visual forms), sites (including StackOverflow) you decode to prove that you are human.

0


a source







All Articles