在它崩溃并让我发疯之前,使用 SSL 进行卷曲登录工作正常。
使用 print_r(curl_getinfo($ch)) 获得以下信息:我的怀疑是“ssl_verify_result”,因为我在文档中读到如果不验证“ssl 证书”,那么它会抛出错误“20”???
[url] => https://www.ooshirts.com/?module=artist&action=login
[content_type] => text/html; charset=UTF-8
[http_code] => 200
[header_size] => 413
[request_size] => 329
[filetime] => -1
**[ssl_verify_result] => 20**
[redirect_count] => 0
[total_time] => 1.404
[namelookup_time] => 0
[connect_time] => 0.265
[pretransfer_time] => 1.107
[size_upload] => 28
[size_download] => 485
[speed_download] => 345
[speed_upload] => 19
[download_content_length] => 485
[upload_content_length] => -1
[starttransfer_time] => 1.404
[redirect_time] => 0
我正在使用本地机器(win7X64)并从实际网站下载 SSL 证书并将其本地存储在同一文件夹中。它工作了几天,但随后又开始返回相同的登录页面。下面是我的测试代码:
$username="username";
$password="******";
$url="https://www.ooshirts.com/?module=artist&action=login";
$cookie=getcwd()."\cookie.txt";
$open = fopen($cookie,"w");
$postdata = "name=".$username."&password=".$password;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CAINFO, getcwd() . "\www.ooshirts.com");
curl_setopt ($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec ($ch);
echo $result;
fclose($open);
有什么帮助???