MyBB Community Forums

Full Version: Stopforumspam Plugin Fix
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I finally got this plugin to work in 1.6 and thought I'd share my solution.
(not sure if this is the correct place but I also added it to the review section).

My server prevents @file_get_contents($url) from running for security reasons. I kept getting the error: Error: StopForumSpam.com could not be reached / Time: Thu, 17 May 2012 18:22:39 -0700

I changed @file_get_contents($url) to a 'curl' function and it works fine now.

If it doesn't work for you find:
$data = @file_get_contents($url)

Find and delete the above line.

Place the following code in place of the old code:
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);

Cheers
Thanks for sharing this.