Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript button click using curl

I have parsed a page using curl and it contains some check box and a 'select all' and a 'submit' button . Clicking the button selects every check box.'select all' button triggers a javascript function which actually select all check box.

Now i need to click 'select all' and 'submit' button.How can I do this ??

Here is the button code:

input type="button" onclick="SelectAll(137)" value="Select All"

Here is the js function:

function SelectAll(n)
{
    for(i=0;i<n;i++)
    document.getElementById("ch"+i).checked=true;
} 
like image 207
Quazi Marufur Rahman Avatar asked Jan 18 '26 01:01

Quazi Marufur Rahman


1 Answers

You can't. If you must use cURL, you'd have to manually craft the POST request yourself. This would involve finding the names of all the checkboxes and sending a bunch of checkbox1=on&checkbox2=on&... in the POST body. See http://davidwalsh.name/execute-http-post-php-curl for a general example of a POST request through cURL with PHP.

Another option would be to use something like Selenium Web Driver, which pretty much allows you to script a web browser like Firefox that can run JavaScript, click things, etc.

like image 136
Jonathan S. Avatar answered Jan 20 '26 13:01

Jonathan S.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!