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.
However, this website requires POST data before it will display the table I require. I know only the name and id of the select boxes through which the data is submitted, as well as the ‘option value’ I need to submit.
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.
How do I go about fetching the table?
Thanks in advance!
Abstract (and poor) representation of the site serving the table:
<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.
Try with curl:
Here are some examples