我创建了这个网站,当访问时自动投票投票。 http://qthostoi.atspace.cc/sdd.php处理回复数据PHP
问题是,当它提交它下载index.php
我不希望这样,我该如何防止?
源代码:
<html>
<body>
<form action="http://recipes.wikia.com/index.php" method="POST" onsubmit="alert(2)">
<input type="hidden" name="title" value="User_blog:Kate.moon/Battle_of_the_Fantasy_Foods-_Round_SIX" />
<input type="hidden" name="action" value="ajax" />
<input type="hidden" name="rs" value="axAjaxPollSubmit" />
<input type="hidden" name="wpPollId" value="B5686B741937166683ACC4DC49C515BB" />
<input type="hidden" name="wpVote" value="Vote!" />
<input type="hidden" name="wpPollRadioB5686B741937166683ACC4DC49C515BB" value="3" />
<input type="submit" value="Submit request" />
</form>
<script>
document.forms[0].submit();
</script>
</body>
</html>
我尝试这些:
1:
<?php
$url = 'http://recipes.wikia.com/index.php';
$fields = array(
'title' => "User_blog:Kate.moon/Battle_of_the_Fantasy_Foods-_Round_SIX",
'action' => "ajax",
'rs' => "axAjaxPollSubmit",
'wpPollId' => "B5686B741937166683ACC4DC49C515BB",
'wpVote' => "Vote!",
'wpPollRadioB5686B741937166683ACC4DC49C515BB' => "3",
);
$count = count($fields);
$fields = http_build_query($fields);
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_POST, $count);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
这做接收响应,并阻止下载,但它没有我的数据提交给其他领域。我认为它提交了错误的数据。
2:
<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<body>
<script>
$("#contactForm").submit(function(event)
{
/* stop form from submitting normally */
event.preventDefault();
/* get some values from elements on the page: */
var $form = $(this),
$submit = $form.find('button[type="submit"]'),
title_value = $form.find('input[name="title"]').val(),
action_value = $form.find('input[name="action"]').val(),
rs_value = $form.find('input[name="wpPollId"]').val(),
wpPollId_value = $form.find('input[name="title"]').val(),
wpVote_value = $form.find('input[name="wpVote"]').val(),
wpPollRadioB5686B741937166683ACC4DC49C515BB_value = $form.find('input[name="wpPollRadioB5686B741937166683ACC4DC49C515BB"]').val(),
message_value = $form.find('textarea[name="message"]').val(),
url = $form.attr('action');
/* Send the data using post */
var posting = $.post(url, {
title: title_value,
action: action_value,
rs: rs_value,
wpPollId: wpPollId_value,
wpVote: wpVote_value,
wpPollRadioB5686B741937166683ACC4DC49C515BB: wpPollRadioB5686B741937166683ACC4DC49C515BB_value
});
posting.done(function(data)
{
/* Put the results in a div */
$("#contactResponse").html(data);
/* Change the button text. */
$submit.text('Sent, Thank you');
/* Disable the button. */
$submit.attr("disabled", true);
});
});
</script>
<form id="contactForm" action="http://recipes.wikia.com/index.php" Method="POST">
<input type="hidden" name="title" value="User_blog:Kate.moon/Battle_of_the_Fantasy_Foods-_Round_SIX" />
<input type="hidden" name="action" value="ajax" />
<input type="hidden" name="rs" value="axAjaxPollSubmit" />
<input type="hidden" name="wpPollId" value="B5686B741937166683ACC4DC49C515BB" />
<input type="hidden" name="wpVote" value="Vote!" />
<input type="hidden" name="wpPollRadioB5686B741937166683ACC4DC49C515BB" value="3" />
<input type="submit" value="Submit request" />
</form>
<div id="contactResponse"></div>
</body>
</html>
它并提交了数据,但下载index.php
任何帮助吗?
有没有什么参考喜欢网页的API? (Recipes.wikia.com)或者你只是尝试模拟你的账户投票。我认为你需要为此登录,因此索引 – 2014-09-26 11:56:38
有可能是index.php有问题,你可以请发布代码? – Ashish 2014-09-26 12:03:07
@FrankProvost我想模拟和Recipies.wikia.com不需要登录它只是检查IP地址没有登录 – 2014-09-26 12:13:34