Hi Sir,
I am trying to collect some data from a php site. However this particular php page has transformed $POST data(to a special timestamp data that I can't replicate) with its own function(setReport() in below code) and sent to its server.
So in order to get this data, enter a stock number in the textbox and press the button is the only way to do I guess.
Below is the snippets from the source of php site that I want to grab data from.
<form name="search" method="post" action="st42.php">
<table width="736" border="0" cellpadding="0" cellspacing="0" summary="查詢">
.......
<td class="search-in02">股票代碼:
<input id="input_stock_code" name="input_stock_code" class="input01" size="6" maxlength="6">
<A HREF="#" onclick="ChoiceStkCode(document.getElementById('input_stock_code'));" onkeypress="ChoiceStkCode(document.getElementById('input_stock_code'));" class="page_table-text_over">代碼查詢</A>
<input type="button" class="input01" value="查詢" onclick="query()" onkeypress="query()"/>
........
</table>
</form>
function query(){
var code = document.getElementsByName("input_stock_code")[0].value;
var param = 'ajax=true&input_stock_code='+code;
setReport('result_st42.php',param );
}
---------------------------------------------------------------------------------
I am thinking of writing a PHP code with following steps to get the data. But I don't know how to do Step 2. Is there everyone who can help on this? Or there is another way to do it? Thanks so much!!!
- Use curl_init to read in the site.
- Set textbox, "input_stock_code" with a value and simulate a button click.
- Parse the results from curl_exec().