function _spambot_request in Spambot 6
1 call to _spambot_request()
- spambot_username_validate in ./
spambot.module - Validation function
File
- ./
spambot.module, line 34
Code
function _spambot_request($url) {
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $url);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
if ($output === FALSE) {
$error = curl_error($ch);
curl_close($ch);
watchdog("spambot", t("curl returned error: @error, request: @request", array(
"@error" => $error,
"@request" => $url,
)));
return false;
}
curl_close($ch);
$xml = new SimpleXMLElement($output);
// drupal_set_message("<pre>" . htmlentities(print_r($xml, TRUE)). "</pre>");
if ($xml->appears == 'yes') {
return true;
}
return false;
}