簡體   English   中英

會話未在codeigniter curl請求上中斷

[英]Session not brougt at codeigniter curl request

我從這里https://github.com/philsturgeon/codeigniter-curl使用codeigniter curl庫創建了一個遠程訪問,然后使用下面的代碼登錄,然后得到很好的響應。

    $this->load->library('curl');        
    $opt = array(
        'COOKIEJAR' => 'curl_sess/cookie.txt',
        'COOKIEFILE' => 'curl_sess/cookie.txt',
    );

    $array = array(
        'email' => 'user@example.com',
        'password' => 'somepassword'
    );
    echo $this->curl->simple_post('http://remoteweb.com/cek_login', $array, $opt);

然后,我想創建另一個需要登錄狀態的請求,例如:

    $array = array();
    echo $this->curl->simple_get('http://remoteweb.com/get_datadeposit', $array);

但我什么也沒得到,因為我在第一個請求時的登錄會話沒有帶來第二個請求。

嘗試

$this->load->library('curl');
$opt = array(
    CURLOPT_COOKIEJAR => 'curl_sess/cookie.txt',
    CURLOPT_RETURNTRANSFER => true
);
$array = array(
    'email' => 'user@example.com',
    'password' => 'somepassword'
);
echo $this->curl->simple_post('http://remoteweb.com/cek_login', $array, $opt);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM