Answer the question
In order to leave comments, you need to log in
How to emulate a browser in php?
What you need:
1) Emulate requests, load and execute js on pages, support cookies.
2) Managing requests and received data on the server, for example, using the same php.
I would like simplicity similar to the same curl (it, of course, does not fit by itself, since it does not work with js).
Is there something similar, habravchane?
Answer the question
In order to leave comments, you need to log in
I don’t know completely in php, but you can interact with selenium or phantomjs.
No need to suffer, write the simplest console application on mono using the standard WebBrowser control (when launched under mono, firefox is used), and write all the logic in javascript, launching it right there on the same page on onload (more precisely, its analogue of the event on the control).
It really turns out to be very simple, all the logic fits into javascript using jquery (it can be loaded into an identifier other than '$'). And at the same time, such an application is launched on any of the cheapest vps linux.
I think between this application and my php messaging can be handled with the simplest push ajax requests or even websocket?
github.com/symfony/BrowserKit - such a thing, but there is no js interpreter
If you need full emulation with ajax and all the goodies, then
xvfb + firefox + mozrepl with which you can already communicate via php.
Another option, used in production MynaJs+HtmlUnit
www.mynajs.org/site/index.ejs
htmlunit.sourceforge.net/
PHP requested what it needed in a MynaJs GET request, and the latter returned JSON.
Has anyone used this - www.simpletest.org/en/browser_documentation.html ??
nightmare under node js
1) save the pages that are obtained after executing js scripts on them into files
2) and then, using php or any other programming language, process these files and do what you want with them
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question