我創建了這個網站,當訪問時自動投票投票。 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