2

I am trying to scrap a web, On the main page, there are a few option buttons and then an ACCEPT button, and RESET button, when ACCEPT button is pressed after selecting appropriate option, new contents are displayed,

my question is, how can I sent a request through curl, when i inspect the ACCEPT button a JavaScript function is initiated, like

JavaScript:someFunction();

Can somebody guide me what should I do? how can I do it via curl and php? Or I should learn some new technique for this, my guess is, the ACCEPT button is sending an AJAX CALL,

guide me please

3
  • 1
    Look at the HTTP requests being made in Firebug / Webkit Inspector and mimic them. Commented Apr 23, 2012 at 17:21
  • okay, I saw http requests in firebug, what will I do now? I will send these via curl? Commented Apr 23, 2012 at 17:48
  • Did you find a good way to do it? Commented Mar 19, 2023 at 17:09

3 Answers 3

2

You need to call that ajax url using cURL and also set those desired variables along with proper values which are set after clicking that button. You can check cURL form posts.

Thanks.

Sign up to request clarification or add additional context in comments.

1 Comment

Do you have any example how to use curl to fire a js click event?
0

Are you trying to simply click the button and submit the form? If that's the case, you can do that with plain javascript:

document.getElementById('acceptButtonId').click();

2 Comments

i am trying to curl the page in php, are you sure you are getting my question?
Can you show an example how to call such endpoint via curl?
0

When the button clicked, you can post the data into the same page. Then with the variables you posted, you use cURL.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.