Skip to content

Commit 7a55c6f

Browse files
authored
Merge pull request #2 from Zjmainstay/feature/add_cookie_param_-b
兼容-b的cookie参数
2 parents 041db05 + 38e794a commit 7a55c6f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/CurlAutoLogin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ public function parseCurl($curlContent) {
151151
$cookieData = $cookieMatch[1];
152152
}
153153

154+
//兼容 -b 参数
155+
if(empty($cookieData) && preg_match("#-b '([^']*)'#is", $curlContent, $cookieMatch)) {
156+
$cookieData = "Cookie: " . $cookieMatch[1];
157+
}
158+
154159
//remove cookie data in header
155160
$curlContent = preg_replace("#-H 'Cookie:[^']*'#is", '', $curlContent);
156161

0 commit comments

Comments
 (0)