对不起,我想问为什么我的脚本只是空白?我想使用curl登录,但这个网站使用https,我想在登录后获取主页。我尝试下载证书,使用{{1 },所以..如何使这个没有空白?
CURLOPT_CAINFO
这是来自inspect元素的html。
$ch = curl_init('https://ragnarok.gravindo.id/member/login_user');
// Enable HTTP POST
curl_setopt($ch, CURLOPT_POST, 1);
// Use SSL
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/crt/gravindoid.crt");
// Set POST parameters
curl_setopt($ch, CURLOPT_POSTFIELDS, 'uname=*****&password=*****');
// Imitate classic browser's behavior - handle cookies
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec($ch);
// Set file to download
curl_setopt($ch, CURLOPT_URL, 'https://ragnarok.gravindo.id/home');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/crt/gravindoid.crt");
echo $content = curl_exec($ch);
curl_close($ch);