2012-11-02 3 views
1

컬을 사용하여 은행에 로그온하려고합니다. 그것은 쿠키 (자바 스크립트에 의해 설정)에 올 때까지 모두 잘 작동합니다.Curl에서 javacookies를 사용하고있는 https에 어떻게 로그인합니까?

enter codssde here 

$post_data['pnr'] = '8502191714'; 
$post_data['password'] = '1111'; 
$post_data['JSEnabled'] = '1'; 
$post_data['OBAS'] =''; 
$post_data['refurlrequiressigning'] = ''; 
$post_data['refurl'] = ''; 


foreach ($post_data as $key => $value) { 
    $post_items[] = $key . '=' . $value; 
} 

$post_array = implode ('&', $post_items); 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); 
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($ch, CURLINFO_HEADER_OUT, 1); 
curl_setopt($ch, CURLOPT_VERBOSE, 1); 
curl_setopt($ch, CURLOPT_CERTINFO, 1); 
curl_setopt($ch, CURLOPT_BUFFERSIZE, 1000000); 

//COOKIES 
$Cookiefile='C:\wamp\www\Project1\gcookies.txt';   
curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookiefile); 
//curl_setopt($ch, CURLOPT_COOKIEJAR, $Cookiefile); 


curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); 
curl_setopt($ch, CURLOPT_TIMEOUT, 120); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array); 

curl_setopt($ch, CURLOPT_URL,'https://www.icabanken.se/Secure/Login/LoginVerify.aspx'); 
$data = curl_exec($ch); 


echo $data; 

내가 얻을 응답은 "브라우저가 지원되지 않는 쿠키"다음 PHP/CURL 코드를 사용

<form method="post" action="https://www.icabanken.se/Secure/Login/LoginVerify.aspx"> 
    <input type="hidden" name="pnr" value="8502191714" /> 
    <input type="hidden" name="JSEnabled" value="1" /> 
    <input type="hidden" name="OBAS" value="" /> 
    <input type="hidden" name="refurl" value="" /> 
    <input type="hidden" name="refurlrequiressigning" value="False" /> 
    <input type="password" class="typetext" name="Password" id="PasswordSimple" maxlength="4" value="1111" /> 
    <input class="button-image button-small" type="submit" id="LoginSimplifiedButton" value="Logga in" /> 
</form> 

이 내가 (자격 증명이 가짜) 보내려고하고있는 모양이다 . 이 문제를 해결할 수있는 깔끔한 해결책이 있습니까?

에서 (그렇지 않으면 단지의 HTTP 트래픽을 볼 수, 당신은 디코딩 HTTPS를 사용하도록 설정해야합니다) 일반적으로 은행에 http://www.fiddler2.com/fiddler2/

로그인 및 피들러 모든 것을 기록합니다

답변

0

내 조언 Fiddler2 같은 것을 사용하는 것 이러한 로그에서 원시 헤더 정보와 원시 쿠키 내용을 볼 수 있습니다. 그런 다음이 정보를 사용하여 로그인을 cURL로 복제하십시오.

관련 문제