1

私はショッピング サイトを持っており、ユーザー名とパスワード、およびその他のデータを銀行に送信する必要があるため、データの投稿に curl を使用しました。安全であるためです。

しかし、私の問題は、カールを使用して銀行にデータを投稿すると、ページのURLt change! I see bankがサーバーページに表示されることです!!!

この投稿データは、HTMLページのリダイレクトの投稿データと同じように、決定されたURLも必要です!!

$data = array(
        "MID" => "0113-19",
        "RedirectURL" => $SERVER . "/shop/profile.php",
        "Amount" => $sum,
        "ResNum" => $ResNum,
        "username" => "xxxx",
        "password" => "1234");
        //traverse array and prepare data for posting (key1=value1)
        foreach ( $data as $key => $value) {
            $data[] = $key . '=' . urlencode($value);
        }



$post_string = implode ('&', $data);
    $res = array();
    $options = array( 
        CURLOPT_RETURNTRANSFER => true,     // return web page 
        CURLOPT_POST => true,     // return web page 
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects 
        CURLOPT_AUTOREFERER    => false,     // set referer on redirect 
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect 
        CURLOPT_TIMEOUT        => 120,      // timeout on response 
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects 
        CURLOPT_POSTFIELDS      => $post_string,       // stop after 10 redirects 
        CURLOPT_SSL_VERIFYPEER      => false ,     // stop after 10 redirects 
        CURLOPT_COOKIEJAR      => "cookie.txt" ,     // stop after 10 redirects 
        CURLOPT_COOKIEFILE      => "cookie.txt" ,     // stop after 10 redirects 
        CURLOPT_SSL_VERIFYPEER      => false ,     // stop after 10 redirects 

        CURLOPT_USERAGENT      => "Mozilla/5.0 (Windows; U;
    Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"      // stop after 10 redirects 
        ); 

    //////////////////////
    $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 ); 
4

0 に答える 0