我在我的 WordPress 主题中使用 BWP Recaptcha(更好的 WordPress Recaptcha)。我的系统在代理后面....
但是每次我尝试发布它都会出错
Could not open socket
所以我用谷歌搜索了解决方案并得到了一个我必须更改功能的东西
recpatchalib.php
改变
function _recaptcha_http_post($host, $path, $data, $port = 80) {
$proxy_host = 'PROXY-HOST';
$proxy_port=PROXY-PORT;
$proxy_username='PROXY-USERNAME';
$proxy_password='PROXY-PASSWORD';
$req = _recaptcha_qsencode ($data);
$http_request = "POST http://$host$path HTTP/1.0\r\n";
$http_request .= "Host: $host\r\n";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
if (!empty($proxy_username)) {
$auth_string = base64_encode($proxy_username . ($proxy_password != '' ? ":{$proxy_password}" : ''));
$http_request .= "Connection: close\r\n";
if ( !empty($auth_string ) ) $http_request .= "Proxy-Authorization: Basic {$auth_string}\r\n";
}
$http_request .= "\r\n";
$http_request .= $req;
$response = '';
if( false == ( $fs = @fsockopen($proxy_host, $proxy_port, $errno, $errstr, 10) ) ) {
die ('Could not open socket');
}
fwrite($fs, $http_request);
while ( !feof($fs) )
$response .= fgets($fs, 1160); // One TCP-IP packet
fclose($fs);
$response = explode("\r\n\r\n", $response, 2);
return $response;
}
即使在实施了这个解决方案之后,系统仍然会说
Could not Open socket
我不是一个经验丰富的 PHP 程序员……我只是在尝试使用 wordpress
在这方面的任何帮助都会有所帮助