PHP using CURL: is there a way to emulate a cookie instead of saving it to a file?

前端 未结 3 582
情歌与酒
情歌与酒 2020-12-31 06:44

I access a REST api service that utilizes a variable called session_id. The API calls for this to be stored in a cookie and I accomplish this as follows:

$ch         


        
3条回答
  •  一生所求
    2020-12-31 06:54

    I use tempnam to generate a unique file name.

    $ckfile = tempnam ("/tmp", "cookieMyWeb");
    curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); 
    

    Generate a new file name before using curl.

提交回复
热议问题