I'm doing a proxys checker by putting a list of proxys in textarea
and the code returns me on the 1 by 1 screen below the other if they work or do not. You are almost all set, the only problem is that no matter what order the proxy list is, proxys are always displayed before the "#LIVE "; if I have a list with 5 proxys that work and 5 that do not work no matter the order they are in textarea
, always the "#DIE" will be displayed first. I want results to be displayed in the order that proxys was placed in textarea
, but how do I do this?
<html>
<head>
<title> chk </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><script>functionenviar(){varbin=$("#bin_id").val();
var linhaenviar = bin.split("\n");
var index = 0;
linhaenviar.forEach(function(value){
setTimeout(
function(){
$.ajax({
url: 'chkp.php',
type: 'POST',
dataType: 'html',
data: "bin=" + value,
success: function(resultado){
$('#oi').html($('#oi').html() + resultado + "<br>");
}
})
}, 10 * index);
index = index + 1;
})
}
</script>
</head>
<body>
<center>
<textarea name="bin" placeholder="PROXY|PORTA" id="bin_id" rows="10" cols="40">
</textarea>
<br>
<input type="button" value="testar" onclick="enviar();"></input>
<br>
<div id="oi" name="oi">
<p></p>
</div>
</center>
</body>
</html>
PHP file:
<?php
error_reporting(0);
if(!empty($_POST["proxy"])){
$proxylist = substr($_POST['proxy'], 0, 90);
$proxy = explode("|", $proxy)[0];
$port = explode("|", $proxy)[1];
explode("|", $proxy)[2];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "host.com/prpxytest");
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 10);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, '_proxy=' . urlencode($proxy) . '&_port=' . urlencode($port));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$dados = curl_exec($ch);
$q = explode('</i>', $dados);
$sal = $q[4];
$msg = ' ';
if(strpos($sal, "Sair") !== false){
$msg = "<b><font color='green'>#LIVE $proxy | $port </font></b>";
}else{
$msg = "<b><font color='red'>#DIE $proxy | $port </font></b>";
}
echo $msg;
}else{ echo 'erro'; }
?>