Re: [請益] 怎麼讓curl對aspx網頁?(以解決)
這是目前寫的程式碼...
但問題是每次送出後,沒有辦法到下一個畫面,都是停在原先的進入畫面...
查詢HEADER也看不出有cookie的痕跡...
應該要跳到的畫面:http://ppt.cc/A8UP
--code--
<?
$link = "http://eschool.firstbank.com.tw/member/index.aspx";
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 13);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
$result_validation = $result_state = curl_exec ($ch);
$token = "__VIEWSTATE";
$result_state = strstr($result_state, $token);
$result_state = substr($result_state, strlen($token));
$endpos = strpos($result_state, '" />');
$result_state = substr($result_state, 26,$endpos-26);
$token = "__EVENTVALIDATION";
$result_validation = strstr($result_validation, $token);
$result_validation = substr($result_validation, strlen($token));
$endpos = strpos($result_validation, '" />');
$result_validation = substr($result_validation, 32,$endpos-32);
$fields = array('__EVENTTARGET' => 'selectCompany',
'__EVENTARGUMENT' => '',
'__LASTFOCUS' => '',
'__VIEWSTATE' => $result_state,
'__EVENTVALIDATION' => $result_validation,
'selectEducationalSystem' => '1',//大專院校
'selectCompany' => '',//學校
'studentNumber' => '',//學號
'login' => '確定',
'timingJavaScript$ctl03' => '');
$post = http_build_query($fields);
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 13);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HEADER, true);
$data=curl_exec($ch);
?>
--endcode--
不知道到底哪裡寫錯了...
有請協助....@@
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.165.217.199
推
09/01 15:59, , 1F
09/01 15:59, 1F
→
09/02 10:02, , 2F
09/02 10:02, 2F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章