darklexus2k9 Posted November 17, 2009 Share Posted November 17, 2009 hi i have a download site and well it gets a lot of spam url posts like the one bellow http://www.ghdsbfhsbhjbfwsbehf.com is there any way the cheek the url entered in a forum before it is submitted to make sure it is live and has the right headers and stuff or have like 2 buttons one is active and one is not the first button is a test button so you click the test button and it cheeks the url in a text feild and if it is live and has the right headers and stuff the second button is activetd and the first one is deactivated any help with this wood realy help a lot thanks pleas no flaming english is my second language so i not so good Quote Link to comment https://forums.phpfreaks.com/topic/181853-need-help-to-stop-spammers/ Share on other sites More sharing options...
JonnoTheDev Posted November 17, 2009 Share Posted November 17, 2009 You can check the http status code from the url i.e a 200 or a 302 is valid. <?php function httpHeader($server) { $fp = @fsockopen($server,80,$errno,$errstr,30); $out = "GET / HTTP/1.1\r\n"; $out .= "Host: $server\r\n"; $out .= "Connection: Close\r\n\r\n"; @fwrite($fp,$out); $content = @fgets($fp); if(strstr($content, "200") || strstr($content, "302")) { return true; } return false; } // usage if(httpHeader("www.bing.com")) { print "url ok"; } else { print "bad url"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/181853-need-help-to-stop-spammers/#findComment-959085 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.