0

I am using Curl To Log into a website and scrap the data. On this website I need to click a js link then download a file. Using Curl I can login and store the session cookies, but how can I use that information to run some js and download a file. Do I need to run all of the code in an emulator or something to that effort.

1 Answer 1

1

As you have already guessed, running JS code requires a JS engine. And because JS code usually interacts with DOM, you also need a DOM context for it. JS engine and a DOM context effectively constructs a headless browser such as Phantom.js. Inside such headless browsers, you can login/click buttons programatically - all JS codes will run normally. However, operating such thing is not a PHP domain anymore.

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

2 Comments

Thanks for the reply, Phantom.js is exactly the type of thin I was looking for. You said "However, operating such thing is not a PHP domain anymore." by this do you mean it can't (or it won't be easy) to run it along side php?
Sorry, i was wrong. Googling "php phantom.js" showed me quite a few php bindings like github.com/jonnnnyw/php-phantomjs. You can control phantomjs in php.

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.