js0505
December 18, 2012, 1:25pm
1
I am trying to perform a button click via cURL and I am having an issue possibly due to java script on click. The HTML source code is:
<input id="ctl00_SPWebPartManager1_g_1bb6dc86_55ab_4ea9_a4db_4747922a8202_ctl00_RequestOption_0" class="radio" type="radio" checked="checked" value="1" name="ctl00$SPWebPartManager1$g_1bb6dc86_55ab_4ea9_a4db_4747922a8202$ctl00$RequestOption">
<label for="ctl00_SPWebPartManager1_g_1bb6dc86_55ab_4ea9_a4db_4747922a8202_ctl00_RequestOption_0"> View Summary Data Online</label>
i send the command this way but it still does not perform that click event:
curl -d "RequestOption_0=1" https://xxx.xxxxx.com/customer-service/rates-pricing/customer-choice/Pages/usage-data.aspx > test20121812.txt
How is the POST supposed to be? Please note that I am using cURL for Windows. Thank you!
Is that the only variable of that form, does the web site also need cookies, does the name needand can you use a different, short name?
curl -d "ctl00_SPWebPartManager1_g_1bb6dc86_55ab_4ea9_a4db_4747922a8202_ctl00_RequestOption_0=1" https://xxx.xxxxx.com/customer-service/rates-pricing/customer-choice/Pages/usage-data.aspx > test20121812.txt
The attributes name and id occupy the same namespace/storage.
js0505
December 19, 2012, 10:30am
3
Yes that is the only variable and yes the site does use cookies. I am just grabbing the name from the html so I do not know if it can be shorter. The page is supposed to refresh after the button click so a text box will appear. Thank you for responding as well, it is greatly appreciated.
---------- Post updated at 09:30 AM ---------- Previous update was at 09:24 AM ----------
I can provide the actual site if need be as well.
The curl man page is not very helpful about supporting cookies, but Google finds this: How do you handle authentication via cookie with CURL? - php | Ask MetaFilter
js0505
December 19, 2012, 10:40am
5
I was able to handle the cookie portion but for some reason curl is running too fast for the page refresh to occur.
curl -retry 3 -m 60 -c cookies.txt -d "ctl00_SPWebPartManager1_g_1bb6dc86_55ab_4ea9_a4db_4747922a8202_ctl00_RequestOption_0=1" https://www.comed.com/customer-service/rates-pricing/customer-choice/Pages/usage-data.aspx > test20121812.txt
curl -retry 3 -m 60 -b cookies.txt -d "ctl00_SPWebPartManager1_g_1bb6dc86_55ab_4ea9_a4db_4747922a8202_ctl00_RequestOption_0=1" https://www.comed.com/customer-service/rates-pricing/customer-choice/Pages/usage-data.aspx > test20121912.txt
Curl gets the file -- scripts in that file soliciting data on additional connections are a new, bigger problem. I am not sure curl runs scripts, but if you can reconstruct the script-generated URL from the file, you can solicit that data.