php 代理脚本可以调用 javascript 函数,比如 click 吗? [英] Can a php proxy script call javascript functions like click?

查看:30
本文介绍了php 代理脚本可以调用 javascript 函数,比如 click 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在添加到 PHProxy 脚本以获取某个页面,并使用 cURL 和一些 R.E. 填写所需的表单.这个页面通常是用一个按钮提交的.我没有直接发布到页面,因为另一台服务器使用带有viewstate"变量的 IIS 服务器,由于我认为em>是客户端浏览器点击传递给它的回调javascript函数.

I'm adding to a PHProxy script to GET a certain page and fills in required forms with cURL and some R.E. This page is usually submitted with a button. I'm not posting directly to a page because the other server uses an IIS server with an 'viewstate' variable that I can't seem to proxyify correctly without receiving viewstate errors from the remote server due to what I think is the callback javascript function that is passed to it by the client browser's click.

因为我正在编写代理脚本,所以我希望我的 PHP 代码能够执行 javascript(例如按下提交按钮)并发回结果,而不会泄露中间的最初请求的页面.

Being that I'm writing a proxy script I want my PHP code to be able to execute the javascript (e.g. pushing the submit button) and send back the result, without ever revealing the intermediate, originally requested page.

有人知道我该怎么做吗?

Does anyone know how I can go about doing this?

这是我想从 PHProxy 中调用的 javascript 回调函数:

Here is the javascript callback function that I would like to call from within PHProxy:

    <input type="submit" name="ctl02$ctl01$ctl00$btnLogin" value="   Sign In   " onclick="javascript:WebForm_DoPostBackWithOpti
ons(new WebForm_PostBackOptions(&quot;ctl02$ctl01$ctl00$btnLogin&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl02_ctl01_ctl
00_btnLogin" class="LoginButton" />

推荐答案

自己解决了,有点.

您可以将 JavaScript 解释器嵌入到您的代码中,例如 PECL 的 SpiderMonkey.但是,为了单击按钮,您需要像浏览器一样从 HTML/CSS/Javascript 代码的一部分重新创建 DOM,以便单击其按钮,目前我找不到和模块这样做.

You can embed a javascript interpreter into your code like PECL's SpiderMonkey. However, in order to click a button you would need to recreate a DOM from a section of HTML/CSS/Javascript code like a browser does in order to click on of its buttons, and currently there aren't and modules that I can find that do this.

引用PHP的HTTP类是否支持javascript?

这篇关于php 代理脚本可以调用 javascript 函数,比如 click 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆