我想多次卷曲一个地址,并在他们之间共享cookie文件。我使用的代码如下:
<?php
$count = $argv[1];
echo $count;
while($count > 0){
$ch = curl_init("somewhere.php");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "./cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "./cookeis.txt");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_COOKIESESSION, true );
$count--;
echo $count;
// grab URL and pass it to the browser
echo curl_exec($ch) . "\n\n";
// close cURL resource, and free up system resources
curl_close($ch);
}
?>
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
somewhere FALSE / FALSE 0 PHPSESSID something
错在哪里?TG。