有没有办法用php调用另一个网站的HTML表单的提交操作


Is there a way to call another website's HTML form's submit action with php?

我正在尝试弄清楚如何自动从中获取搜索结果http://pokemonshowdown.com/replay/

    <form action="/replay/search/" method="get" data-target="replace">
        <p style="text-align:center">
            <label><input type="text" name="user" class="textbox" placeholder="Format or username" size="24" /></label>
            <button type="submit"><strong>Search</strong></button>
        </p>
    </form>

但我不知道如何使用代码触发表单的onsubmit操作,只能通过单击它X_X

计划获取搜索结果并使用它们自动循环播放,这样我就不必一直点击它们来观看。

如果我猜对了,你想在外部网站上发起搜索吗?因为它是一个获取表单,所以应该通过请求 URL "http://pokemonshowdown.com/replay/search/?key=value"轻松完成。您不必真正提交表单,只需调用表单在发生 onclick-event 时将调用的 URL。

当然,键和值必须替换为要插入的字段名称和值。将连接多个参数,例如键 1=值 1&键 2=值 2。