dtf1111 2014-02-26 22:00
浏览 33

wget或curl在同一个php页面上有两个表单

I am working with a php page with multiple forms. I enter information into the first form and click submit. Then it takes me to the second form where I check "I agree" and hit submit. Both of these forms are on the same php page however.

I can get both curl and wget to act on the first form but not the second. I tried saving the cookie and loading it but neither seems to work. Here is my code for both:

curl -k --cookie-jar cookie.txt -d "login=$user&pass=$pass" https://member.testurl.com/login.php
curl -k --cookie cookie.txt -d "i_agree=1&do_agreement=1&data=$data" https://member.testurl.com/login.php

wget --save-cookies testcookie.txt --keep-session-cookies --post-data "login=$user&pass=$pass" https://member.testurl.com/login.php
wget --load-cookies testcookie.txt --post-data "i_agree=1&do_agreement=1&data=$data" https://member.testurl.com/login.php

As I said, the cookie from the first form appears to save as there is data in the cookie file but I am unable to get to the second form. The second part of either command seems to try and post to the first form again instead of the second. Is the cookie not loading? Something peculiar with the page?

  • 写回答

0条回答 默认 最新

    报告相同问题?