从需要POST数据的站点获取数据? [英] Fetching data from a site requiring POST data?

查看:69
本文介绍了从需要POST数据的站点获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个非常简单的网站,其中仅包含我想检索表的一些元素.以前,我已经将file_get_contents('http://www.example.com')用于此确切目的,并通过explode和str_replace命令提取了我需要的信息,效果很好.

There's a very simple website containing just a few elements of which I'd like to retrieve a table. Previously I've used file_get_contents('http://www.example.com') for this exact purpose and extracted the piece of information I needed through explode and str_replace commands, which worked fine.

但是,此网站需要POST数据,然后才能显示我需要的表.我只知道通过其提交数据的选择框的名称和ID,以及我需要提交的选项值".

另一件事是第二个选择框仅在处理完第一个选择框后出现,就像表格仅在两个选项都被选中后才出现.

Another thing is that the second select box only appears once the first one has been dealt with, much like the table only appears once an option has been chosen for both.

如何获取表格?

提前谢谢!

提供表格的网站的抽象形式(效果不佳):

    <select id='select_box_1' name='first select box'>
      <option value='option1_1'>Thing one</option>
      <option value='option1_2'>Second thing</option>
      <option value='option1_3'>Thing number three</option>
    </select>

    NOTE: Selecting an option will spawn:

    <select id='select_box_2' name='second select box'>
      <option value='option2_1'>First thing</option>
      <option value='option2_2'>Second choice</option>
      <option value='option2_3'>The third option</option>
    </select>

    NOTE: Selecting an option will spawn the table I need.

推荐答案

尝试使用 curl :

这里是一些示例

这篇关于从需要POST数据的站点获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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