I'm trying to get the data of a page by curl library. I can do it with simple link, but when I'm going to submit a form and then get the data , I can not. It returns me the default value of page, not the submitted form. Let me explain the code.
$url = ...
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
// I'm sending post data
$params = array(
'madrak'=>5,
'B1' => 'مشاهده اطلاعات'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// and execute...
The page I'm getting data is written with asp and the form part of that page is this:
<input type="submit" value="مشاهده اطلاعات" name="B1">
<select name="madrak" size="1" class="style1" id="1">
<option value="1">زير ديپلم</option>
<option value="5">ديپلم</option>
<option value="6">فوق ديپلم</option>
<option value="7">ليسانس</option>
<option value="8">فوق ليسانس</option>
<option value="9">دكترا</option>
<option selected="" value="6">فوق ديپلم</option>
</select>
It seems that the form is not being submitted. Because just I can get the data which is loading without form submitting. Any idea?
http_code. But it returns data.curl_exec(). Yes, it returns 200.