2011-06-25 9 views
1

私がページにログインしようとすると、500内部サーバーエラーが表示されます。ページはhttpsにあります。ここでcurl .net httpsページログインの問題500内部サーバーのエラー

は、ログイン機能である:

function login ($login, $pass) { 

    $loginURL = "https://bitomat.pl/Account/LogOn"; 
    $loginPage = $this->curl->getPage($loginURL); 
    $numStart = strpos(htmlentities($loginPage['content']), "type="hidden" value=""); 
    $numEnd = strpos(htmlentities($loginPage['content']), "<fieldset>"); 
    $verNum = substr(htmlentities($loginPage['content']), $numStart+36, 64); 
    echo $numStart." - ".$numEnd." - ".$verNum."<br>"; 
    $page = $this->curl->post($loginURL, "__RequestVerificationToken=".urlencode($verNum)."&UserName=$login&Password=".urlencode($pass)."&RememberMe=false"); 

    echo nl2br(htmlentities($page['content'])); 

} 

応答では、私が得る:

HTTP/1.1 500 Internal Server Error 
    Cache-Control: private 
    Content-Type: text/html; charset=utf-8 
    Server: Microsoft-IIS/7.0 
    X-AspNetMvc-Version: 2.0 
    X-AspNet-Version: 4.0.30319 
    X-Powered-By: ASP.NET 
    Date: Sat, 25 Jun 2011 16:32:18 GMT 
    Content-Length: 3974 

カールポスト機能:

function post($url, $params) { 
    $rnd = rand(0, 10000000000); 

    $options = array(
     CURLOPT_COOKIESESSION => true, 
     CURLOPT_COOKIEFILE => "cookie/cookieBitomat",// . $rnd, 
     CURLOPT_COOKIEJAR => "cookie/cookieBitomat",// . $rnd, 
     CURLOPT_RETURNTRANSFER => true, // return web page 
     CURLOPT_HEADER => true, // don't return headers 
     CURLOPT_FOLLOWLOCATION => true, // follow redirects 
     CURLOPT_POST => true, 
     CURLOPT_POSTFIELDS => $params, 
     CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1", // who am i 
     CURLOPT_AUTOREFERER => true, // set referer on redirect 
     CURLOPT_CONNECTTIMEOUT => 60, // timeout on connect 
     CURLOPT_TIMEOUT => 60, // timeout on response 
     CURLOPT_MAXREDIRS => 20, // stop after 10 redirects 
     CURLOPT_SSL_VERIFYPEER => false, 
     CURLOPT_VERBOSE => TRUE, 
     CURLOPT_HTTPHEADER => array("Content-Type: application/x-www-form-urlencoded", 
      "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", 
      "Host: bitomat.pl", 
      "Accept-Language: pl,en-us;q=0.7,en;q=0.3", 
      "Accept-Encoding: gzip, deflate", 
      "Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7", 
      "Keep-Alive: 115", 
      "Connection: keep-alive", 
      "Referer: https://bitomat.pl/Account/LogOn" 
      ) 
    ); 


    $ch = curl_init($url); 
    curl_setopt_array($ch, $options); 
    $content = curl_exec($ch); 
    $err = curl_errno($ch); 
    $errmsg = curl_error($ch); 
    $header = curl_getinfo($ch); 
    curl_close($ch); 

    $header['errno'] = $err; 
    $header['errmsg'] = $errmsg; 
    $header['content'] = $content; 
    return $header; 
} 

答えて

1

をので、あなたのHTTP通常あなたはこのようなケースでは500を取得します要求はブラウザがこの状況で行うものと多少異なり、サーバ側スクリプトはsometとみなしますそれについてヒンジ。

「ライブ」リクエストを検査し、可能な限りそれを真似してください。

関連する問題