Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/181853-need-help-to-stop-spammers/
Share on other sites

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";
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.