我对此代码有疑问:
<html>
<head><title>Son_Of_Diablo's Hit Booster</title>
<script language="JavaScript">
function onlyNumbers(evt)
{
var e = event || evt;
var charCode = e.which || e.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script></head>
<body bgcolor="black">
<style type="text/css">
body,td,th {
color: #00CC00;
}
</style>
<div align=center>
<h1>Son_Of_Diablo's Hit Booster</h1><br />
<form action="" method ="post">
Site to boost: <br /><input type="text" name="url" style="border:3px double #00CC00;background-color:#000000;color:#00CC00;" /><br /><br />
Proxy to use: <br /><textarea rows="5" cols="16" type="text" name="proxy" style="border:3px double #00CC00;background-color:#000000;color:#00CC00;" /></textarea><br /><br />
User Agent to use: <br /><input type="text" name="agent" style="border:3px double #00CC00;background-color:#000000;color:#00CC00;" /><br /><br />
Referer from:<br /> <input type="text" name="ref" style="border:3px double #00CC00;background-color:#000000;color:#00CC00;" /><br /><br />
How many hits: <br /><input type="text" name="num" onkeypress="return onlyNumbers();" value="1" style="border:3px double #00CC00;background-color:#000000;color:#00CC00;" /><br /><br />
<input type="submit" value="BOOST" style="border:3px double #00CC00;background-color:#000000;color:#00CC00;" />
</form>
</div>
<?php
function upordown($url, $proxy, $agent, $ref){
$agents = array("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17", "Mozilla/6.0 (Windows NT 6.2; WOW64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1", "Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0", "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25", "Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02");
$agentsL = count($agents);
$max = $agentsL;
$cs = curl_init($url);
$agentt = rand(0, 5);
curl_setopt($cs, CURLOPT_NOBODY, true);
//curl_setopt($cs, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($cs, CURLOPT_PROXY, $proxy);
curl_setopt($cs, CURLOPT_USERAGENT, $agent);
curl_setopt($cs, CURLOPT_REFERER, $ref);
curl_exec($cs);
sleep(10);
curl_close ($cs);
}
if (isset($_POST['url']) == true && empty($_POST['url']) == false){
$count = 0;
$num = $_POST['num'];
$proxy = $_POST['proxy'];
$proxyE = explode("\n", $proxy);
$proxyL = count($proxyE);
while ($count < $num){
//if($count != $proxyL && $count < $proxyL){
$url = trim($_POST['url']);
$agent = $_POST['agent'];
$agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17";
$ref = $_POST['ref'];
foreach($proxyE as $proxys){
if(filter_var($url, FILTER_VALIDATE_URL) == true){
if(upordown($url, $proxys, $agent, $ref) == true){
}else{
echo 'Failed to add a hit from <strong>'.$proxys.'</strong><br />';
}
}else{
echo 'Invalid URL';
}
$count++;
/*}else{
echo "<strong>ERROR:</strong> Not enought proxies!";
}*/}}
}
?>
<br /><br />
<hr />
<br />
</body>
</html>
我知道这真的很乱......
所以我的问题是当我使用curl_setopt($cs, CURLOPT_PROXY, $proxy);
我不会工作:/ 但如果我发表评论它就可以了。
有谁能看到我做错了什么?
非常感谢!