0

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 />&nbsp;&nbsp;
<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‌​&amp;id=4&user_hash=e6bf03ffeb6865eadb62eb9d7d99c88e&text_type=1"
4

1 に答える 1

0

Chrome の Developer Tools または Firefox の Firebug を使用して、HTTP 通信プロセスをトレースします。

投稿されたデータは js スクリプトのようなもので処理される可能性があるため、Web ページのソースのみを使用する場合は sth を無視してかまいません。

于 2012-08-17T06:34:15.440 に答える