Skip to content

Commit

Permalink
增加从curl解析cookie并存储方法addCookieFromCurl
Browse files Browse the repository at this point in the history
  • Loading branch information
Zjmainstay authored Jun 12, 2024
1 parent 9ce1487 commit f2ab449
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/CurlAutoLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,4 +533,15 @@ public function formatHeaderCookieToFileContent($headerCookie, $domain) {
}
return implode("\n", $rows);
}

/**
* 从curl内容解析cookie内容并追加保存到cookie文件
* @param $curlContent string
* @param $domain string //授权域名,如www.baidu.com,则传入.baidu.com,根前面有个点
*/
public function addCookieFromCurl($curlContent, $domain) {
$parseCurlResult = $this->parseCurl($curlContent); //解析curl内容获取cookie内容
$cookieContent = $this->formatHeaderCookieToFileContent($parseCurlResult["cookie"], $domain); //格式化cookie内容
$this->appendCookieContent($cookieContent); //追加cookie内容到cookie文件
}
}

0 comments on commit f2ab449

Please sign in to comment.