以下是我用来尝试完成此操作的代码:
<?php
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'linkToLoginPage.php');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'email=email@example.com,password=password');
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_setopt($ch, CURLOPT_URL, 'linkToDownloadFile.pdf');
$content = curl_exec ($ch);
curl_close ($ch);
?>
我用我的信息设置它,但它只是产生一个空白页面。我认为我的主要问题是CURLOPT_POSTFIELDS
。 Here is the link to the page I am trying to login
我查看了源代码但是找不到表单值的明确定义。有什么想法吗?
答案 0 :(得分:1)
尝试
curl_setopt($ch,
CURLOPT_POSTFIELDS,
'email=email@example.com&password=password' );
(&
不是,
)