我正在尝试为帐户创建者网站发布帖子请求,我每次都需要使用不同的IP,因此验证码不会显示。所以我尝试使用curl_setopt($ch, CURLOPT_PROXY, "https://188.166.213.255:3128");
设置代理。当我不使用代理设置它连接正常但刷新页面3-4次后,我被验证码击中。我想通过使用代理来绕过它,但我一直无法连接到[IP]端口[端口]。
如果重要,我的网站将由namecheap托管。 不确定namecheap是否阻止连接。
我已经尝试了超过1000个代理,我尝试了一些我知道使用python程序的代理,我使用的代码就像我的网站一样。
我使用的完整代码:
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_PROXY, "https://188.166.213.255:3128");
//curl_setopt($ch, CURLOPT_PROXYTYPE, 'SOCK5');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 12);
curl_setopt($ch, CURLOPT_TIMEOUT, 12);
//curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);;
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $additional_headers);
$server_output = curl_exec($ch);
if (curl_errno($ch)) {
// this would be your first hint that something went wrong
//echo $resultStatus."<br>";
die('Curl error: ' . curl_error($ch));
}
else {
$resultStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($resultStatus == 403 or $resultStatus == 200) {
if (strpos($server_output, 'Captcha') !== false) {
echo 'Failed to create account due to the Captcha.';
} else {
$date = date("Y-m-d H:i:s");
$conn = new mysqli(host, username, password, database);
$sql = "INSERT INTO Accounts (Name, Password, Date, Result) VALUES ('" . $username . "', '" . $password . "', '" . $date . "', '" . $server_output . "')";
if (mysqli_query($conn, $sql)) {
echo "Account Created!";
echo "<br>";
echo "Username: " . $username . "";
echo "<br>";
echo "Password: " . $password . "";
echo "<br>";
echo "Response: " . $server_output . "";
echo "<br>New Server";
}
else {
echo "Rip: " . $sql . "<br>" . $conn->error;
}
mysqli_close($conn);
}
$worked = True;
}
else {
die('Request failed: HTTP status code: ' . $resultStatus);
}
}
curl_close($ch);