简体   繁体   English

使用PHP在实时网页上提交表单

[英]Submitting a form on a live webpage with PHP

I'm trying to find a way for PHP to press the "submit" button on a PHP form on a live webpage. 我正在尝试为PHP找到在实时网页上的PHP表单上按“提交”按钮的方法。

I need to do this as I am unsure as towards what data is send through this form, as it is a post form and the API is closed source. 我需要执行此操作,因为我不确定通过此表单发送的数据,因为它是邮政表单,并且API是封闭源。

Is there anyway to send a jQuery like click command to a live webpage through PHP at all? 无论如何,根本没有通过PHP将jQuery之类的click命令发送到实时网页吗?

Nothing needs to be retrieved from this form, only needs to have pressed the button correctly. 无需从此表单中检索任何内容,只需要正确按下按钮即可。

EDIT 编辑

More context: 更多内容:

Yes, the site is 3rd party (this is why I can't simply look up something on any API documentation), the program is downloading a gallery of images through the in-site gallery archiver. 是的,该网站是第三方的(这就是为什么我不能简单地在任何API文档中查找内容的原因),该程序正在通过内部库存档程序下载图像库。 Previously the URL for this gallery's archive was stored on a simple popup window page's source. 以前,此画廊存档的URL存储在一个简单的弹出窗口页面的源中。 Now however you must confirm it first the page reloads (after a form submits through POST) onto the same page (archiver.php) and the download starts. 现在,但是您必须首先确认它(在通过POST提交表单之后)将页面重新加载到同一页面(archiver.php)并开始下载。 This reloaded page contains the URL of the file. 重新加载的页面包含文件的URL。 Nothing is submitted beyond the users confirmation to the download manually, perhaps something in the back end is sent upon this, I don't know. 除了用户确认之外,没有任何东西提交给手动下载,也许与此有关的是后端发送的,我不知道。

EDIT 2 编辑2

I've fixed this by figuring out what the form submits. 我已通过弄清表单提交的内容来解决此问题。

I think it is not possible to click a button on another page with php or jquery. 我认为不可能用php或jquery单击另一页上的按钮。

But you can analyse the form and find out the destination URL and send a own request. 但是您可以分析表单并找出目标URL并发送自己的请求。 If it is GET it should look like this: myhomepage.com?id=1&name=foo&password=hello123 如果是GET,则应如下所示:myhomepage.com?id=1&name=foo&password=hello123

you have to use jQuery or javaScript For pressing submit button on live page dynamically. 您必须使用jQuery或javaScript在动态页面上动态按下Submit按钮。 PHP is server side script and from is client side so its not possible. PHP是服务器端脚本,而来自客户端,因此这是不可能的。 but if you want to read data from live webpage than you have to use cURL or file_get content 但是,如果您想从实时网页中读取数据,则必须使用cURL或file_get内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM