G
G
germn2013-06-19 19:04:47
PHP
germn, 2013-06-19 19:04:47

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

13 answer(s)
Y
Yuri Shikanov, 2013-06-19
@germn

I don’t know completely in php, but you can interact with selenium or phantomjs.

R
rPman, 2013-06-19
@rPman

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?

N
Nikita Gusakov, 2013-06-19
@hell0w0rd

github.com/symfony/BrowserKit - such a thing, but there is no js interpreter

T
taviscaron, 2013-06-19
@taviscaron

selenium webdriver will help

S
Stepan, 2013-06-19
@L3n1n

If you need full emulation with ajax and all the goodies, then
xvfb + firefox + mozrepl with which you can already communicate via php.

A
AFoST, 2013-06-19
@AFoST

Maybe some jasmine (unit tests) + sinon\mockjax (response emulation)?

O
Oleg Barabanov, 2013-06-19
@olegbarabanov

System call in node-webkit windowless mode .

O
Oleksandr Brichuk, 2013-06-21
@aleksandro

Another option, used in production MynaJs+HtmlUnit
www.mynajs.org/site/index.ejs
htmlunit.sourceforge.net/

O
Oleksandr Brichuk, 2013-06-21
@aleksandro

PHP requested what it needed in a MynaJs GET request, and the latter returned JSON.

H
Hazrat Hajikerimov, 2013-11-25
@hazratgs

What are you looking for! SNOOPY

S
smileonl, 2013-06-20
@smileonl

It won't work in php. Use phantomjs.org/

K
klimzp, 2014-06-05
@klimzp

Has anyone used this - www.simpletest.org/en/browser_documentation.html ??

D
dimatelegin, 2019-12-27
@dimatelegin

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 question

Ask a Question

731 491 924 answers to any question