我很难理解如何使用 curl 提交内容。我已经使用此代码成功登录:
curl $HOST -s -L -b $COOKIE -c $COOKIE -d "login=submit&login_name=$USER&login_password=$PASS" > /dev/null
<input name="login" type="hidden" id="login" value="submit" />
但是当我在另一个页面上尝试类似的东西时它不起作用,它让我发疯:
curl $RSS -s -L -b $COOKIE -c $COOKIE -F "submitrssauto=doit" -o rss
<form name="submitrss" action="" method="post">
<input type="submit" name="submitrssauto" id="submitrssauto" value="doit" class="buttons">
<input type=hidden name="allow_main" value="1">
<input type=hidden name="allow_rating" value="1">
<input type=hidden name="allow_comm" value="1">
<input type=hidden name="lastdate" value="1345109704">
<input type=hidden name="id" value="4">
<input type="hidden" name="user_hash" value="e6bf03ffeb6865eadb62eb9d7d99c88e" />
<input type=hidden name="text_type" value="1">
</forum>
php代码:
echo <<<HTML
<br />
<form name="submitrss" action="" method="post">
<input type="submit" name="submitrssauto" id="submitrssauto" value="doit" class="buttons">
<input type=hidden name="allow_main" value="{$rss['allow_main']}">
<input type=hidden name="allow_rating" value="{$rss['allow_rating']}">
<input type=hidden name="allow_comm" value="{$rss['allow_comm']}">
<input type=hidden name="lastdate" value="{$xml->lastdate}">
<input type=hidden name="id" value="{$id}">
<input type="hidden" name="user_hash" value="$dle_login_hash" />
<input type=hidden name="text_type" value="{$rss['text_type']}">
</forum>
HTML;
这是我迄今为止尝试过的:
curl $RSS -s -L -b $COOKIE -c $COOKIE -F "submitrssauto=doit" -o rss
curl $RSS -s -L -b $COOKIE -c $COOKIE -d "submitrssauto=doit" -o rss
curl $RSS -s -L -b $COOKIE -c $COOKIE -o rss -d "submitrssauto=doit&allow_main=1&allow_rating=1&allow_comm=1&lastdate=1345109704&id=4&user_hash=e6bf03ffeb6865eadb62eb9d7d99c88e&text_type=1"