Does PHP's HTTP class support javascript?

2019-08-25 06:49发布

In regards to Can a PHP Proxy call Javascript functions like a click I'm investigating a solution that involves using PHP's HTTP class to simulate a client's browser.

Does anyone know if the PHP HTTP class supports javascript functions? Can you recommend any others that do?

Thanks!

标签: php http
2条回答
仙女界的扛把子
2楼-- · 2019-08-25 07:24

An Http stream handler is not in any way related to a browser. It will not generate a DOM tree, block ads or execute javascript - it is just a library handling the http protocol.

查看更多
何必那么认真
3楼-- · 2019-08-25 07:42

No, it does not. You have to implement this yourself. If you want to have it all-serverside, look into phpjs, j4p5 or better yet the spidermonkey pecl extension. http://pecl.php.net/package/spidermonkey

A better alternative might be to script a real browser yourself via an XPI plugin / XPCOM bridge. There once was an extension called "JSSh", and another "SD connector", http://www.activestate.com/blog/2008/05/jssh-replacement-sd-connector

Neither of these options is simple. That's why nobody has done it, and why such extravagant features are specifically not in the HTTP class.

查看更多
登录 后发表回答